Merge lp:~compiz-team/compiz-wall-plugin/compiz-wall-plugin.fix_762335 into lp:compiz-wall-plugin

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 129
Proposed branch: lp:~compiz-team/compiz-wall-plugin/compiz-wall-plugin.fix_762335
Merge into: lp:compiz-wall-plugin
Diff against target: 68 lines (+49/-2)
1 file modified
src/wall.cpp (+49/-2)
To merge this branch: bzr merge lp:~compiz-team/compiz-wall-plugin/compiz-wall-plugin.fix_762335
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+78964@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wall.cpp'
2--- src/wall.cpp 2011-03-14 16:07:54 +0000
3+++ src/wall.cpp 2011-10-11 13:45:27 +0000
4@@ -608,7 +608,7 @@
5 int dx, dy;
6 CompPoint viewport;
7
8- viewport = window->defaultViewport ();
9+ screen->viewportForGeometry (window->geometry (), viewport);
10 dx = viewport.x ();
11 dy = viewport.y ();
12
13@@ -617,8 +617,55 @@
14
15 if (dx || dy)
16 {
17- ws->moveViewport (-dx, -dy, None);
18+ XWindowChanges xwc;
19+ unsigned int mask = 0;
20+
21+ ws->moveViewport (-dx, -dy, false);
22 ws->focusDefault = false;
23+
24+ CompWindow::Geometry sbr (window->serverBorderRect ().x (),
25+ window->serverBorderRect ().y (),
26+ window->serverBorderRect ().width (),
27+ window->serverBorderRect ().height (),
28+ 0);
29+ CompRegion sbrRegion (sbr);
30+ int output = screen->outputDeviceForGeometry (sbr);
31+ CompRegion outputRegion (screen->outputDevs ()[output].workArea ());
32+
33+ /* If the window would be partially offscreen
34+ * after it was moved then we should move it back
35+ * so that it is completely onscreen, since we moved
36+ * from mostly offscreen on B to mostly onscreen on A,
37+ * the user should be able to see their selected window */
38+ CompRegion inter = sbrRegion.intersected (outputRegion);
39+ CompRegion rem = sbrRegion - outputRegion;
40+
41+ foreach (const CompRect &r, rem.rects ())
42+ {
43+ if (r.x1 () >= inter.boundingRect ().x2 ())
44+ {
45+ xwc.x = window->serverGeometry ().x () - r.width ();
46+ mask |= CWX;
47+ }
48+ else if (r.x2 () <= inter.boundingRect ().x1 ())
49+ {
50+ xwc.x = window->serverGeometry ().x () + r.width ();
51+ mask |= CWX;
52+ }
53+
54+ if (r.y1 () >= inter.boundingRect ().y2 ())
55+ {
56+ xwc.y = window->serverGeometry ().y () - r.height ();
57+ mask |= CWY;
58+ }
59+ else if (r.y2 () <= inter.boundingRect ().y1 ())
60+ {
61+ xwc.y = window->serverGeometry ().y () + r.height ();
62+ mask |= CWY;
63+ }
64+ }
65+
66+ window->configureXWindow (mask, &xwc);
67 }
68 }
69

Subscribers

People subscribed via source and target branches

to all changes: