~linaro-maintainers/compiz-plugins-main/overlay-gl

« back to all changes in this revision

Viewing changes to debian/patches/fix-862261-860646.patch

  • Committer: Sam Spilsbury
  • Date: 2011-10-07 16:09:42 UTC
  • Revision ID: sam.spilsbury@canonical.com-20111007160942-9zkw97vowa95galq
Added some new patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'src/snap.cpp'
 
2
Index: compiz-plugins-main-0.9.6/snap/src/snap.cpp
 
3
===================================================================
 
4
--- compiz-plugins-main-0.9.6.orig/snap/src/snap.cpp    2011-10-04 01:27:48.107556695 +0800
 
5
+++ compiz-plugins-main-0.9.6/snap/src/snap.cpp 2011-10-04 01:29:25.420039241 +0800
 
6
@@ -396,7 +396,7 @@
 
7
        // Update snapping data
 
8
        if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
 
9
        {
 
10
-           snapped = true;
 
11
+           snapGeometry = window->serverGeometry ();
 
12
            this->snapDirection |= snapDirection;
 
13
        }
 
14
        // Attract the window if needed, moving it of the correct dist
 
15
@@ -487,7 +487,7 @@
 
16
        // Update snapping data
 
17
        if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
 
18
        {
 
19
-           snapped = true;
 
20
+           snapGeometry = window->serverGeometry ();
 
21
            this->snapDirection |= snapDirection;
 
22
        }
 
23
        // FIXME : this needs resize-specific code.
 
24
@@ -591,7 +591,7 @@
 
25
        // If there's horizontal snapping, add dx to current buffered
 
26
        // dx and resist (move by -dx) or release the window and move
 
27
        // by buffered dx - dx, same for dh
 
28
-       if (snapped && snapDirection & HorizontalSnap)
 
29
+       if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
 
30
        {
 
31
            m_dx += dx;
 
32
            if (m_dx < ss->optionGetResistanceDistance ()
 
33
@@ -622,7 +622,7 @@
 
34
        }
 
35
 
 
36
        // Same for vertical snapping and dy/dh
 
37
-       if (snapped && snapDirection & VerticalSnap)
 
38
+       if (snapGeometry.isEmpty () && snapDirection & VerticalSnap)
 
39
        {
 
40
            m_dy += dy;
 
41
            if (m_dy < ss->optionGetResistanceDistance ()
 
42
@@ -652,8 +652,8 @@
 
43
            }
 
44
        }
 
45
        // If we are no longer snapping in any direction, reset snapped
 
46
-       if (snapped && !snapDirection)
 
47
-           snapped = false;
 
48
+       if (!snapGeometry.isEmpty () && !snapDirection)
 
49
+           snapGeometry = CompWindow::Geometry ();
 
50
     }
 
51
 
 
52
     // If we don't already snap vertically and horizontally,
 
53
@@ -681,6 +681,13 @@
 
54
        return;
 
55
     }
 
56
 
 
57
+    // don't snap maximized windows
 
58
+    if (window->state () & CompWindowStateMaximizedHorzMask)
 
59
+       dx = 0;
 
60
+
 
61
+    if (window->state () & CompWindowStateMaximizedVertMask)
 
62
+       dy = 0;
 
63
+
 
64
     // avoiding snap, nothing buffered
 
65
     if (!ss->snapping)
 
66
        return;
 
67
@@ -691,13 +698,14 @@
 
68
        // If there's horizontal snapping, add dx to current buffered
 
69
        // dx and resist (move by -dx) or release the window and move
 
70
        // by buffered dx - dx
 
71
-       if (snapped && snapDirection & HorizontalSnap)
 
72
+       if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
 
73
        {
 
74
            m_dx += dx;
 
75
            if (m_dx < ss->optionGetResistanceDistance ()
 
76
                && m_dx > -ss->optionGetResistanceDistance ())
 
77
            {
 
78
-               move (-dx, 0);
 
79
+               dx = snapGeometry.x () - window->geometry ().x ();
 
80
+               move (dx, 0);
 
81
            }
 
82
            else
 
83
            {
 
84
@@ -707,13 +715,14 @@
 
85
            }
 
86
        }
 
87
        // Same for vertical snapping and dy
 
88
-       if (snapped && snapDirection & VerticalSnap)
 
89
+       if (!snapGeometry.isEmpty () && snapDirection & VerticalSnap)
 
90
        {
 
91
            m_dy += dy;
 
92
            if (m_dy < ss->optionGetResistanceDistance ()
 
93
                && m_dy > -ss->optionGetResistanceDistance ())
 
94
            {
 
95
-               move (0, -dy);
 
96
+               dy = snapGeometry.y () - window->geometry ().y ();
 
97
+               move (0, dy);
 
98
            }
 
99
            else
 
100
            {
 
101
@@ -723,8 +732,8 @@
 
102
            }
 
103
        }
 
104
        // If we are no longer snapping in any direction, reset snapped
 
105
-       if (snapped && !snapDirection)
 
106
-           snapped = false;
 
107
+       if (!snapGeometry.isEmpty () && !snapDirection)
 
108
+           snapGeometry = CompWindow::Geometry ();
 
109
     }
 
110
     // If we don't already snap vertically and horizontally,
 
111
     // check edges status
 
112
@@ -753,7 +762,7 @@
 
113
 {
 
114
     edges.clear ();
 
115
 
 
116
-    snapped = false;
 
117
+    snapGeometry = CompWindow::Geometry ();
 
118
     snapDirection = 0;
 
119
     grabbed = 0;
 
120
     m_dx = m_dy = m_dwidth = m_dheight = 0;
 
121
@@ -809,7 +818,7 @@
 
122
     m_dy (0),
 
123
     m_dwidth (0),
 
124
     m_dheight (0),
 
125
-    snapped (false),
 
126
+    snapGeometry (0, 0, 0, 0, 0),
 
127
     grabbed (0),
 
128
     skipNotify (false)
 
129
 {
 
130
Index: compiz-plugins-main-0.9.6/snap/src/snap.h
 
131
===================================================================
 
132
--- compiz-plugins-main-0.9.6.orig/snap/src/snap.h      2011-10-04 01:27:48.119556749 +0800
 
133
+++ compiz-plugins-main-0.9.6/snap/src/snap.h   2011-10-04 01:29:28.364053840 +0800
 
134
@@ -127,7 +127,7 @@
 
135
        int m_dheight;
 
136
 
 
137
        // internals
 
138
-       bool snapped;
 
139
+       CompWindow::Geometry snapGeometry;
 
140
        int grabbed;
 
141
 
 
142
        // internal, avoids infinite notify loops