Merge lp:~aacid/compiz/do_not_change_viewport_on_resize into lp:compiz/0.9.9

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3363
Merged at revision: 3417
Proposed branch: lp:~aacid/compiz/do_not_change_viewport_on_resize
Merge into: lp:compiz/0.9.9
Diff against target: 84 lines (+9/-15)
1 file modified
src/window.cpp (+9/-15)
To merge this branch: bzr merge lp:~aacid/compiz/do_not_change_viewport_on_resize
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
jenkins (community) continuous-integration Approve
Sam Spilsbury Needs Information
Review via email: mp+129089@code.launchpad.net

This proposal supersedes a proposal from 2012-09-28.

Commit message

Do not move windows between viewports/workspaces when changing its size
(e.g. maximizing). (LP: #776435)

.

Description of the change

Do not move windows between viewports/workspaces when changing its size (e.g. maximizing)

To be honest i'm a bit "scared" since this touches a function used by lots of other functions, but if we never want a window to change to a different viewports/workspaces i guess it makes sense.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hmm, I think the intention of this code is to prevent windows that maximize themselves from going on to other viewports. I think it might make sense to add a check here to check if the window is on the currently active viewport, and if so, to always maximize it on that viewport.

Do you think you might be able to get this code under test?

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Actually, I'm not sure about the validity of the bug itself. The bug seems to be that windows get maximized on the workspace which contains their centre-point. That's the way it was designed and the way it works. But that's not what's always intuitive to the user and hence the bug.

If that's the functionality we're aiming to change here then it looks like the wrong code is being modified.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I think you should look at this instead:

screen.cpp: compiz::private_screen::viewports::viewportForGeometry

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Daniel, right, the code is doign what you say (maximize on the workspace which contains their centre-point) which both I and Sam (that set the bug to Confirmed) think does not make sense.

I disagree the wrong code is being modified, what
   CompScreenImpl::viewportForGeometry (const CompWindow::Geometry& gm, CompPoint& viewport)
does is not return in viewport the viewport that gm should have but the "difference" in viewports from the current one, i.e. it can return {-1, -1} if it thinks the window shall be one viewport left and one top from its current one.

Of course I could make that function return always {0,0} (i.e. don't move me) but that might potentially break other plugins that use it like the group and the wall plugins

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

OK, I have no opinion until I can review this in detail later.

review: Abstain
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

FWIW: I'm going on holiday tomorrow, will be back on 1st October

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

The branches have changed. Please resubmit targeting lp:compiz

review: Needs Resubmitting
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I don't think I'll have time in the foreseeable future to get this under test. Are we happy to merge it without tests? What was the result from manual testing?

review: Needs Information
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

I have done limited manual testing and it works as I would expect it to work, but that is of course not much :D

As for unit testing if you give me some instructions as of how you'd like this unit tested i can give it a try.

Otherwise we can try to merge it to a R-only branch and let very early adopters do the testing?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Reviewed and tested again. It looks correct and fixes the bug.

Although the relevant logic is a prime candidate for automated testing, the relevant classes are not yet isolated enough to be unit-testable. And doing so in src/window.cpp is a risky proposition.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/window.cpp'
2--- src/window.cpp 2012-09-18 15:51:59 +0000
3+++ src/window.cpp 2012-10-11 03:23:33 +0000
4@@ -3495,15 +3495,9 @@
5 {
6 CompRect workArea;
7 int mask = 0;
8- int x, y;
9 CompOutput *output;
10 CompPoint viewport;
11
12- screen->viewportForGeometry (old, viewport);
13-
14- x = (viewport.x () - screen->vp ().x ()) * screen->width ();
15- y = (viewport.y () - screen->vp ().y ()) * screen->height ();
16-
17 /* Try to select and output device that the window is on first
18 * and make sure if we are fullscreening or maximizing that the
19 * window is actually able to fit on this output ... otherwise
20@@ -3585,15 +3579,15 @@
21
22 if (fullscreenMonitorsSet)
23 {
24- xwc->x = x + fullscreenMonitorRect.x ();
25- xwc->y = y + fullscreenMonitorRect.y ();
26+ xwc->x = fullscreenMonitorRect.x ();
27+ xwc->y = fullscreenMonitorRect.y ();
28 xwc->width = fullscreenMonitorRect.width ();
29 xwc->height = fullscreenMonitorRect.height ();
30 }
31 else
32 {
33- xwc->x = x + output->x ();
34- xwc->y = y + output->y ();
35+ xwc->x = output->x ();
36+ xwc->y = output->y ();
37 xwc->width = output->width ();
38 xwc->height = output->height ();
39 }
40@@ -3695,7 +3689,7 @@
41 * by the gravity value (so that the corner that the gravity specifies
42 * is 'anchored' to that edge of the workarea) */
43
44- xwc->y = y + workArea.y () + border.top;
45+ xwc->y = workArea.y () + border.top;
46 mask |= CWY;
47
48 switch (priv->sizeHints.win_gravity)
49@@ -3706,7 +3700,7 @@
50 /* Shift the window so that the bottom meets the top of the bottom */
51 height = xwc->height + old.border () * 2;
52
53- max = y + workArea.bottom ();
54+ max = workArea.bottom ();
55 if (xwc->y + xwc->height + border.bottom > max)
56 {
57 xwc->y = max - height - border.bottom;
58@@ -3732,7 +3726,7 @@
59
60 if (state & CompWindowStateMaximizedHorzMask)
61 {
62- xwc->x = x + workArea.x () + border.left;
63+ xwc->x = workArea.x () + border.left;
64 mask |= CWX;
65
66 switch (priv->sizeHints.win_gravity)
67@@ -3742,7 +3736,7 @@
68 case EastGravity:
69 width = xwc->width + old.border () * 2;
70
71- max = x + workArea.right ();
72+ max = workArea.right ();
73
74 if (old.x () + (int) old.width () + border.right > max)
75 {
76@@ -3751,7 +3745,7 @@
77 }
78 else if (old.x () + width + border.right > max)
79 {
80- xwc->x = x + workArea.x () +
81+ xwc->x = workArea.x () +
82 (workArea.width () - border.left - width -
83 border.right) / 2 + border.left;
84 mask |= CWX;

Subscribers

People subscribed via source and target branches