Merge lp:~townsend/compiz/fix-vertical-maximize-normal into lp:compiz/0.9.11

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3842
Merged at revision: 3842
Proposed branch: lp:~townsend/compiz/fix-vertical-maximize-normal
Merge into: lp:compiz/0.9.11
Diff against target: 106 lines (+39/-4)
5 files modified
plugins/resize/src/logic/include/window-interface.h (+2/-0)
plugins/resize/src/logic/src/resize-logic.cpp (+12/-4)
plugins/resize/src/logic/tests/mock-window.h (+2/-0)
plugins/resize/src/logic/tests/test-logic.cpp (+13/-0)
plugins/resize/src/window-impl.h (+10/-0)
To merge this branch: bzr merge lp:~townsend/compiz/fix-vertical-maximize-normal
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+210473@code.launchpad.net

Commit message

Fix issues where vertically maximizing windows by dragging the grab area using Normal mode would result in:
* Incorrect restored window size.
* Wrong window size when vertically maximized, especially when resizing from the bottom of the window.

Description of the change

Fix issues where vertically maximizing windows by dragging the grab area using Normal mode would result in:
* Incorrect restored window size.
* Wrong window size when vertically maximized, especially when resizing from the bottom of the window.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
3842. By Christopher Townsend

Fix logic test to account for the new saveWc & saveMask implementations.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool, it works like a charm and code looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/resize/src/logic/include/window-interface.h'
--- plugins/resize/src/logic/include/window-interface.h 2012-12-10 03:28:47 +0000
+++ plugins/resize/src/logic/include/window-interface.h 2014-03-12 19:06:58 +0000
@@ -74,6 +74,8 @@
74 virtual int outputDevice () = 0;74 virtual int outputDevice () = 0;
75 virtual const CompSize serverSize () const = 0;75 virtual const CompSize serverSize () const = 0;
76 virtual void maximize (unsigned int state = 0) = 0;76 virtual void maximize (unsigned int state = 0) = 0;
77 virtual XWindowChanges & saveWc () = 0;
78 virtual int & saveMask () = 0;
7779
78 /* equivalent of CompMatch::evaluate */80 /* equivalent of CompMatch::evaluate */
79 virtual bool evaluate (CompMatch &match) = 0;81 virtual bool evaluate (CompMatch &match) = 0;
8082
=== modified file 'plugins/resize/src/logic/src/resize-logic.cpp'
--- plugins/resize/src/logic/src/resize-logic.cpp 2013-05-12 09:39:45 +0000
+++ plugins/resize/src/logic/src/resize-logic.cpp 2014-03-12 19:06:58 +0000
@@ -1442,12 +1442,20 @@
1442 {1442 {
1443 w->maximize (CompWindowStateMaximizedVertMask);1443 w->maximize (CompWindowStateMaximizedVertMask);
14441444
1445 xwc.x = geometryWithoutVertMax.x;1445 xwc.x = geometry.x;
1446 xwc.y = geometryWithoutVertMax.y;1446 xwc.y = geometry.y;
1447 xwc.width = geometryWithoutVertMax.width;1447 xwc.width = geometry.width;
1448 xwc.height = geometryWithoutVertMax.height;1448 xwc.height = geometry.height;
14491449
1450 mask = CWX | CWY | CWWidth | CWHeight;1450 mask = CWX | CWY | CWWidth | CWHeight;
1451
1452 /* Once vertically maximized, save the original window y & height
1453 * geometry, so restoring the window will result in the correct size */
1454 w->saveWc ().y = savedGeometry.y;
1455 w->saveWc ().height = savedGeometry.height + (w->border ().top +
1456 w->border ().bottom);
1457
1458 w->saveMask () = CWY | CWHeight;
1451 }1459 }
1452 }1460 }
1453 else1461 else
14541462
=== modified file 'plugins/resize/src/logic/tests/mock-window.h'
--- plugins/resize/src/logic/tests/mock-window.h 2012-08-16 14:04:59 +0000
+++ plugins/resize/src/logic/tests/mock-window.h 2014-03-12 19:06:58 +0000
@@ -69,6 +69,8 @@
69 MOCK_METHOD0(outputDevice, int());69 MOCK_METHOD0(outputDevice, int());
70 MOCK_CONST_METHOD0(serverSize, const CompSize());70 MOCK_CONST_METHOD0(serverSize, const CompSize());
71 MOCK_METHOD1(maximize, void(unsigned int state));71 MOCK_METHOD1(maximize, void(unsigned int state));
72 MOCK_METHOD0(saveWc, XWindowChanges &());
73 MOCK_METHOD0(saveMask, int &());
72 MOCK_METHOD1(evaluate, bool(CompMatch &match));74 MOCK_METHOD1(evaluate, bool(CompMatch &match));
7375
74 MOCK_METHOD0(getResizeInterface, ResizeWindowInterface*());76 MOCK_METHOD0(getResizeInterface, ResizeWindowInterface*());
7577
=== modified file 'plugins/resize/src/logic/tests/test-logic.cpp'
--- plugins/resize/src/logic/tests/test-logic.cpp 2013-01-09 05:30:46 +0000
+++ plugins/resize/src/logic/tests/test-logic.cpp 2014-03-12 19:06:58 +0000
@@ -97,6 +97,17 @@
97 EXPECT_CALL (mockWindow, border ())97 EXPECT_CALL (mockWindow, border ())
98 .WillRepeatedly (ReturnRef (mockWindowBorder));98 .WillRepeatedly (ReturnRef (mockWindowBorder));
9999
100 mockSaveWc.x = 1;
101 mockSaveWc.y = 2;
102 mockSaveWc.width = 3;
103 mockSaveWc.height = 4;
104 EXPECT_CALL (mockWindow, saveWc ())
105 .WillRepeatedly (ReturnRef (mockSaveWc));
106
107 mockSaveMask = 1;
108 EXPECT_CALL (mockWindow, saveMask ())
109 .WillRepeatedly (ReturnRef (mockSaveMask));
110
100 EXPECT_CALL (mockWindow, grabNotify (_,_,_,_))111 EXPECT_CALL (mockWindow, grabNotify (_,_,_,_))
101 .Times(AnyNumber());112 .Times(AnyNumber());
102113
@@ -202,6 +213,8 @@
202 CompWindow::Geometry mockWindowServerGeometry;213 CompWindow::Geometry mockWindowServerGeometry;
203 unsigned int mockWindowState;214 unsigned int mockWindowState;
204 CompWindowExtents mockWindowBorder;215 CompWindowExtents mockWindowBorder;
216 XWindowChanges mockSaveWc;
217 int mockSaveMask;
205};218};
206219
207220
208221
=== modified file 'plugins/resize/src/window-impl.h'
--- plugins/resize/src/window-impl.h 2013-01-08 09:17:25 +0000
+++ plugins/resize/src/window-impl.h 2014-03-12 19:06:58 +0000
@@ -201,6 +201,16 @@
201 mImpl->maximize (state);201 mImpl->maximize (state);
202 }202 }
203203
204 virtual XWindowChanges & saveWc ()
205 {
206 return mImpl->saveWc ();
207 }
208
209 virtual int & saveMask ()
210 {
211 return mImpl->saveMask ();
212 }
213
204 virtual bool evaluate (CompMatch &match)214 virtual bool evaluate (CompMatch &match)
205 {215 {
206 return match.evaluate (mImpl);216 return match.evaluate (mImpl);

Subscribers

People subscribed via source and target branches