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
1=== modified file 'plugins/resize/src/logic/include/window-interface.h'
2--- plugins/resize/src/logic/include/window-interface.h 2012-12-10 03:28:47 +0000
3+++ plugins/resize/src/logic/include/window-interface.h 2014-03-12 19:06:58 +0000
4@@ -74,6 +74,8 @@
5 virtual int outputDevice () = 0;
6 virtual const CompSize serverSize () const = 0;
7 virtual void maximize (unsigned int state = 0) = 0;
8+ virtual XWindowChanges & saveWc () = 0;
9+ virtual int & saveMask () = 0;
10
11 /* equivalent of CompMatch::evaluate */
12 virtual bool evaluate (CompMatch &match) = 0;
13
14=== modified file 'plugins/resize/src/logic/src/resize-logic.cpp'
15--- plugins/resize/src/logic/src/resize-logic.cpp 2013-05-12 09:39:45 +0000
16+++ plugins/resize/src/logic/src/resize-logic.cpp 2014-03-12 19:06:58 +0000
17@@ -1442,12 +1442,20 @@
18 {
19 w->maximize (CompWindowStateMaximizedVertMask);
20
21- xwc.x = geometryWithoutVertMax.x;
22- xwc.y = geometryWithoutVertMax.y;
23- xwc.width = geometryWithoutVertMax.width;
24- xwc.height = geometryWithoutVertMax.height;
25+ xwc.x = geometry.x;
26+ xwc.y = geometry.y;
27+ xwc.width = geometry.width;
28+ xwc.height = geometry.height;
29
30 mask = CWX | CWY | CWWidth | CWHeight;
31+
32+ /* Once vertically maximized, save the original window y & height
33+ * geometry, so restoring the window will result in the correct size */
34+ w->saveWc ().y = savedGeometry.y;
35+ w->saveWc ().height = savedGeometry.height + (w->border ().top +
36+ w->border ().bottom);
37+
38+ w->saveMask () = CWY | CWHeight;
39 }
40 }
41 else
42
43=== modified file 'plugins/resize/src/logic/tests/mock-window.h'
44--- plugins/resize/src/logic/tests/mock-window.h 2012-08-16 14:04:59 +0000
45+++ plugins/resize/src/logic/tests/mock-window.h 2014-03-12 19:06:58 +0000
46@@ -69,6 +69,8 @@
47 MOCK_METHOD0(outputDevice, int());
48 MOCK_CONST_METHOD0(serverSize, const CompSize());
49 MOCK_METHOD1(maximize, void(unsigned int state));
50+ MOCK_METHOD0(saveWc, XWindowChanges &());
51+ MOCK_METHOD0(saveMask, int &());
52 MOCK_METHOD1(evaluate, bool(CompMatch &match));
53
54 MOCK_METHOD0(getResizeInterface, ResizeWindowInterface*());
55
56=== modified file 'plugins/resize/src/logic/tests/test-logic.cpp'
57--- plugins/resize/src/logic/tests/test-logic.cpp 2013-01-09 05:30:46 +0000
58+++ plugins/resize/src/logic/tests/test-logic.cpp 2014-03-12 19:06:58 +0000
59@@ -97,6 +97,17 @@
60 EXPECT_CALL (mockWindow, border ())
61 .WillRepeatedly (ReturnRef (mockWindowBorder));
62
63+ mockSaveWc.x = 1;
64+ mockSaveWc.y = 2;
65+ mockSaveWc.width = 3;
66+ mockSaveWc.height = 4;
67+ EXPECT_CALL (mockWindow, saveWc ())
68+ .WillRepeatedly (ReturnRef (mockSaveWc));
69+
70+ mockSaveMask = 1;
71+ EXPECT_CALL (mockWindow, saveMask ())
72+ .WillRepeatedly (ReturnRef (mockSaveMask));
73+
74 EXPECT_CALL (mockWindow, grabNotify (_,_,_,_))
75 .Times(AnyNumber());
76
77@@ -202,6 +213,8 @@
78 CompWindow::Geometry mockWindowServerGeometry;
79 unsigned int mockWindowState;
80 CompWindowExtents mockWindowBorder;
81+ XWindowChanges mockSaveWc;
82+ int mockSaveMask;
83 };
84
85
86
87=== modified file 'plugins/resize/src/window-impl.h'
88--- plugins/resize/src/window-impl.h 2013-01-08 09:17:25 +0000
89+++ plugins/resize/src/window-impl.h 2014-03-12 19:06:58 +0000
90@@ -201,6 +201,16 @@
91 mImpl->maximize (state);
92 }
93
94+ virtual XWindowChanges & saveWc ()
95+ {
96+ return mImpl->saveWc ();
97+ }
98+
99+ virtual int & saveMask ()
100+ {
101+ return mImpl->saveMask ();
102+ }
103+
104 virtual bool evaluate (CompMatch &match)
105 {
106 return match.evaluate (mImpl);

Subscribers

People subscribed via source and target branches