Merge lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646 into lp:compiz-snap-plugin

Proposed by Sam Spilsbury on 2011-09-27
Status: Merged
Merged at revision: 54
Proposed branch: lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646
Merge into: lp:compiz-snap-plugin
Diff against target: 126 lines (+17/-15)
2 files modified
src/snap.cpp (+16/-14)
src/snap.h (+1/-1)
To merge this branch: bzr merge lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646
Reviewer Review Type Date Requested Status
Jason Smith (community) 2011-09-27 Approve on 2011-09-27
Review via email: mp+77181@code.launchpad.net

Description of the change

To post a comment you must log in.
Jason Smith (jassmith) wrote :

+1

review: Approve
54. By Sam Spilsbury on 2011-09-27

Merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/snap.cpp'
2--- src/snap.cpp 2011-03-14 16:04:25 +0000
3+++ src/snap.cpp 2011-09-27 15:14:23 +0000
4@@ -396,7 +396,7 @@
5 // Update snapping data
6 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
7 {
8- snapped = true;
9+ snapGeometry = window->serverGeometry ();
10 this->snapDirection |= snapDirection;
11 }
12 // Attract the window if needed, moving it of the correct dist
13@@ -487,7 +487,7 @@
14 // Update snapping data
15 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
16 {
17- snapped = true;
18+ snapGeometry = window->serverGeometry ();
19 this->snapDirection |= snapDirection;
20 }
21 // FIXME : this needs resize-specific code.
22@@ -591,7 +591,7 @@
23 // If there's horizontal snapping, add dx to current buffered
24 // dx and resist (move by -dx) or release the window and move
25 // by buffered dx - dx, same for dh
26- if (snapped && snapDirection & HorizontalSnap)
27+ if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
28 {
29 m_dx += dx;
30 if (m_dx < ss->optionGetResistanceDistance ()
31@@ -622,7 +622,7 @@
32 }
33
34 // Same for vertical snapping and dy/dh
35- if (snapped && snapDirection & VerticalSnap)
36+ if (snapGeometry.isEmpty () && snapDirection & VerticalSnap)
37 {
38 m_dy += dy;
39 if (m_dy < ss->optionGetResistanceDistance ()
40@@ -652,8 +652,8 @@
41 }
42 }
43 // If we are no longer snapping in any direction, reset snapped
44- if (snapped && !snapDirection)
45- snapped = false;
46+ if (!snapGeometry.isEmpty () && !snapDirection)
47+ snapGeometry = CompWindow::Geometry ();
48 }
49
50 // If we don't already snap vertically and horizontally,
51@@ -691,13 +691,14 @@
52 // If there's horizontal snapping, add dx to current buffered
53 // dx and resist (move by -dx) or release the window and move
54 // by buffered dx - dx
55- if (snapped && snapDirection & HorizontalSnap)
56+ if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
57 {
58 m_dx += dx;
59 if (m_dx < ss->optionGetResistanceDistance ()
60 && m_dx > -ss->optionGetResistanceDistance ())
61 {
62- move (-dx, 0);
63+ dx = snapGeometry.x () - window->geometry ().x ();
64+ move (dx, 0);
65 }
66 else
67 {
68@@ -707,13 +708,14 @@
69 }
70 }
71 // Same for vertical snapping and dy
72- if (snapped && snapDirection & VerticalSnap)
73+ if (!snapGeometry.isEmpty () && snapDirection & VerticalSnap)
74 {
75 m_dy += dy;
76 if (m_dy < ss->optionGetResistanceDistance ()
77 && m_dy > -ss->optionGetResistanceDistance ())
78 {
79- move (0, -dy);
80+ dy = snapGeometry.y () - window->geometry ().y ();
81+ move (0, dy);
82 }
83 else
84 {
85@@ -723,8 +725,8 @@
86 }
87 }
88 // If we are no longer snapping in any direction, reset snapped
89- if (snapped && !snapDirection)
90- snapped = false;
91+ if (!snapGeometry.isEmpty () && !snapDirection)
92+ snapGeometry = CompWindow::Geometry ();
93 }
94 // If we don't already snap vertically and horizontally,
95 // check edges status
96@@ -753,7 +755,7 @@
97 {
98 edges.clear ();
99
100- snapped = false;
101+ snapGeometry = CompWindow::Geometry ();
102 snapDirection = 0;
103 grabbed = 0;
104 m_dx = m_dy = m_dwidth = m_dheight = 0;
105@@ -809,7 +811,7 @@
106 m_dy (0),
107 m_dwidth (0),
108 m_dheight (0),
109- snapped (false),
110+ snapGeometry (0, 0, 0, 0, 0),
111 grabbed (0),
112 skipNotify (false)
113 {
114
115=== modified file 'src/snap.h'
116--- src/snap.h 2009-07-28 13:58:37 +0000
117+++ src/snap.h 2011-09-27 15:14:23 +0000
118@@ -127,7 +127,7 @@
119 int m_dheight;
120
121 // internals
122- bool snapped;
123+ CompWindow::Geometry snapGeometry;
124 int grabbed;
125
126 // internal, avoids infinite notify loops

Subscribers

People subscribed via source and target branches

to all changes: