Merge lp:~smspillaz/compiz-snap-plugin/compiz-snap-plugin.work_923683 into lp:compiz-snap-plugin

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 63
Proposed branch: lp:~smspillaz/compiz-snap-plugin/compiz-snap-plugin.work_923683
Merge into: lp:compiz-snap-plugin
Diff against target: 96 lines (+12/-12)
1 file modified
src/snap.cpp (+12/-12)
To merge this branch: bzr merge lp:~smspillaz/compiz-snap-plugin/compiz-snap-plugin.work_923683
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+91779@code.launchpad.net

Commit message

Adapt for behavioural changes in lp:~smspillaz/compiz-core/compiz-core.work_923683

Description of the change

Adapt for behavioural changes in lp:~smspillaz/compiz-core/compiz-core.work_923683

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
64. By Sam Spilsbury

Use server side rects

65. By Sam Spilsbury

Explicitly move the window backwards, don't buffer movement from directions we can't
move in because we're maximized and remove the last move distance from the snap buffer
when releasing the snap buffer instead of adding it.

Fixes mouse desynchronization problems, eg LP #892012

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-10-11 17:12:40 +0000
3+++ src/snap.cpp 2012-04-14 03:37:18 +0000
4@@ -60,7 +60,7 @@
5 void
6 SnapWindow::resize (int dx, int dy, int dwidth, int dheight)
7 {
8- CompWindow::Geometry geometry = window->geometry ();
9+ const CompWindow::Geometry &geometry = window->serverGeometry ();
10 skipNotify = true;
11 window->resize (geometry.x () + dx, geometry.y () + dy,
12 geometry.width () + dwidth, geometry.height () + dheight,
13@@ -192,7 +192,7 @@
14 continue;
15 }
16
17- input = w->borderRect ();
18+ input = w->serverBorderRect ();
19 addEdge (w->id (), input.top (), input.left (),
20 input.right (), TopEdge, false);
21 addEdge (w->id (), input.bottom (), input.left (),
22@@ -422,7 +422,7 @@
23 // Update snapping data
24 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
25 {
26- snapGeometry = window->geometry ();
27+ snapGeometry = window->serverGeometry ();
28 this->snapDirection |= snapDirection;
29 }
30 // Attract the window if needed, moving it of the correct dist
31@@ -456,7 +456,7 @@
32 void
33 SnapWindow::moveCheckEdges (int snapDirection)
34 {
35- CompRect input (window->borderRect ());
36+ CompRect input (window->serverBorderRect ());
37 moveCheckNearestEdge (input.left (), input.top (), input.bottom (),
38 true, RightEdge, HorizontalSnap & snapDirection);
39 moveCheckNearestEdge (input.right (), input.top (), input.bottom (),
40@@ -548,7 +548,7 @@
41 void
42 SnapWindow::resizeCheckEdges (int dx, int dy, int dwidth, int dheight)
43 {
44- CompRect input (window->borderRect ());
45+ CompRect input (window->serverBorderRect ());
46
47 resizeCheckNearestEdge (input.left (), input.top (), input.bottom (),
48 true, RightEdge, HorizontalSnap);
49@@ -728,6 +728,9 @@
50 return;
51 }
52
53+ dx = window->serverGeometry ().x () - snapGeometry.x ();
54+ dy = window->serverGeometry ().y () - snapGeometry.y ();
55+
56 // don't snap maximized windows
57 if (window->state () & CompWindowStateMaximizedHorzMask)
58 {
59@@ -745,9 +748,6 @@
60 if (!ss->snapping)
61 return;
62
63- dx = snapGeometry.x () - window->geometry ().x ();
64- dy = snapGeometry.y () - window->geometry ().y ();
65-
66 // apply edge resistance
67 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
68 {
69@@ -756,11 +756,11 @@
70 // by buffered dx - dx
71 if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
72 {
73- m_dx += -dx;
74+ m_dx += dx;
75 if (m_dx < ss->optionGetResistanceDistance ()
76 && m_dx > -ss->optionGetResistanceDistance ())
77 {
78- move (dx, 0, false);
79+ move (-dx, 0, false);
80 }
81 else
82 {
83@@ -772,11 +772,11 @@
84 // Same for vertical snapping and dy
85 if (!snapGeometry.isEmpty () && snapDirection & VerticalSnap)
86 {
87- m_dy += -dy;
88+ m_dy += dy;
89 if (m_dy < ss->optionGetResistanceDistance ()
90 && m_dy > -ss->optionGetResistanceDistance ())
91 {
92- move (0, dy, false);
93+ move (0, -dy, false);
94 }
95 else
96 {

Subscribers

People subscribed via source and target branches