Merge lp:~3v1n0/compiz/fix-outputs-for-windows-in-workspaces into lp:compiz/0.9.12

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Stephen M. Webb
Approved revision: 3960
Merged at revision: 3966
Proposed branch: lp:~3v1n0/compiz/fix-outputs-for-windows-in-workspaces
Merge into: lp:compiz/0.9.12
Diff against target: 50 lines (+20/-5)
1 file modified
src/window.cpp (+20/-5)
To merge this branch: bzr merge lp:~3v1n0/compiz/fix-outputs-for-windows-in-workspaces
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Stephen M. Webb Approve
Review via email: mp+265158@code.launchpad.net

Commit message

Window: compute the correct output using the absolute window position

Window geometry has absolute coordinates that include viewports, but we
need to use viewport relative coordinates when figuring out the window output
or the window will be considered offscreen and thus it will fallback to first monitor.
This is generally applied, but was not done well in addWindowSizeChanges which
was causing Fullscreen and (horizontally) maximized windows to be moved to the
primary monitor when activated.

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

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 2014-09-16 19:37:23 +0000
3+++ src/window.cpp 2015-07-17 17:44:11 +0000
4@@ -3572,7 +3572,11 @@
5 int x = (viewport.x () - screen->vp ().x ()) * screen->width ();
6 int y = (viewport.y () - screen->vp ().y ()) * screen->height ();
7
8- CompOutput *output = &screen->outputDevs ().at (screen->outputDeviceForGeometry (old));
9+ CompWindow::Geometry old_relative_to_vp(old.x () - x, old.y () - y,
10+ old.width (), old.height (),
11+ old.border ());
12+ int outputDev = screen->outputDeviceForGeometry (old_relative_to_vp);
13+ CompOutput *output = &screen->outputDevs ().at (outputDev);
14
15 /*
16 * output is now the correct output for the given geometry.
17@@ -5129,7 +5133,19 @@
18 int
19 CompWindow::outputDevice () const
20 {
21- return screen->outputDeviceForGeometry (priv->serverGeometry);
22+ const CompPoint& vp = defaultViewport ();
23+ const CompPoint& svp = screen->vp ();
24+
25+ if (vp == svp)
26+ return screen->outputDeviceForGeometry (priv->serverGeometry);
27+
28+ Geometry geo (priv->serverGeometry.x () + (svp.x () - vp.x ()) * screen->width (),
29+ priv->serverGeometry.y () + (svp.y () - vp.y ()) * screen->height (),
30+ priv->serverGeometry.width (),
31+ priv->serverGeometry.height (),
32+ priv->serverGeometry.border ());
33+
34+ return screen->outputDeviceForGeometry (geo);
35 }
36
37 bool
38@@ -5987,10 +6003,9 @@
39
40 CompPoint vp = window->defaultViewport ();
41 CompPoint svp = screen->vp ();
42- CompSize size = *screen;
43
44- int x = window->serverGeometry ().x () + (svp.x () - vp.x ()) * size.width ();
45- int y = window->serverGeometry ().y () + (svp.y () - vp.y ()) * size.height ();
46+ int x = window->serverGeometry ().x () + (svp.x () - vp.x ()) * screen->width ();
47+ int y = window->serverGeometry ().y () + (svp.y () - vp.y ()) * screen->height ();
48 window->moveToViewportPosition (x, y, true);
49
50 if (allowWindowFocus (0, timestamp))

Subscribers

People subscribed via source and target branches