Merge lp:~townsend/unity/fix-lp1251777 into lp:unity

Proposed by Christopher Townsend
Status: Rejected
Rejected by: Christopher Townsend
Proposed branch: lp:~townsend/unity/fix-lp1251777
Merge into: lp:unity
Diff against target: 37 lines (+12/-0)
2 files modified
tests/autopilot/unity/tests/test_wm_keybindings.py (+8/-0)
unity-shared/PluginAdapter.cpp (+4/-0)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1251777
Reviewer Review Type Date Requested Status
Christopher Townsend Disapprove
Brandon Schaefer (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196020@code.launchpad.net

Commit message

Fixes issue when using the Ctrl-Super-Left/Right shortcuts to vertically semi-maximize a window and then restoring the window would not place the window back in its original place.

Description of the change

= Issue =
Due to revno. 3509, when vertically semi-maximizing a window using Ctrl-Super-Left/Right and then restoring the window, the window would not return to the same place and correct size.

= Fix =
Save the x coordinate and width (including borders), so restoring will be correct.

= Test =
Added to the test_restore_vertically_maximized_window AP test to save the window geometry before vertically semi-maximizing and then get the geometry after restoring and then compare the two.

To post a comment you must log in.
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 :

Mh, for some reason this doesn't seem to work to me... The window goes back to center but using the full height...

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

If you semi max a window Left, then Right. Then click on the decoration title bar it puts the window back into an incorrect position. I've tested that its this branch that is causing it. Similar to what Marco is describing.

Other then that it seems to be working quite well.

review: Needs Fixing
Revision history for this message
Christopher Townsend (townsend) wrote :

Rejecting this since I re-did how this is done with a different MP.

review: Disapprove

Unmerged revisions

3598. By Christopher Townsend

Fixes issue when using the Ctrl-Super-Left/Right shortcuts to vertically semi-maximize a window and then restoring the window would not place the wi
ndow back in its original place.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_wm_keybindings.py'
2--- tests/autopilot/unity/tests/test_wm_keybindings.py 2013-10-08 14:20:04 +0000
3+++ tests/autopilot/unity/tests/test_wm_keybindings.py 2013-11-20 21:38:42 +0000
4@@ -126,10 +126,18 @@
5 if not self.start_restored:
6 self.addCleanup(self.keybinding, "window/maximize")
7 self.keybinding("window/restore")
8+ (x1, y1, w1, h1) = self.screen_win.geometry
9 self.keyboard.press_and_release("Ctrl+Super+Right")
10 self.keybinding("window/restore")
11+ (x2, y2, w2, h2) = self.screen_win.geometry
12+
13 self.assertThat(self.screen_win.vertically_maximized, Eventually(Equals(False)))
14 self.assertThat(self.screen_win.minimized, Eventually(Equals(False)))
15+ # Make sure the window restored to its same geometry before vertically maximizing
16+ self.assertThat(x1, Equals(x2))
17+ self.assertThat(y1, Equals(y2))
18+ self.assertThat(w1, Equals(w2))
19+ self.assertThat(h1, Equals(h2))
20
21 def test_minimize_restored_window(self):
22 if not self.start_restored:
23
24=== modified file 'unity-shared/PluginAdapter.cpp'
25--- unity-shared/PluginAdapter.cpp 2013-11-14 00:17:19 +0000
26+++ unity-shared/PluginAdapter.cpp 2013-11-20 21:38:42 +0000
27@@ -726,6 +726,10 @@
28 if (!(window->state() & CompWindowStateMaximizedVertMask))
29 window->maximize(CompWindowStateMaximizedVertMask);
30
31+ window->saveMask() |= CWX | CWWidth;
32+ window->saveWc().x = window->x() - window->border().left;
33+ window->saveWc().width = window->width() + window->border().left + window->border().right;
34+
35 /* Then we resize and move it on the requested place */
36 MoveResizeWindow(window->id(), geo);
37 }