Merge lp:~smspillaz/compiz-grid-plugin/oneiric.fix_796594 into lp:~compiz-team/compiz-grid-plugin/oneiric

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 89
Proposed branch: lp:~smspillaz/compiz-grid-plugin/oneiric.fix_796594
Merge into: lp:~compiz-team/compiz-grid-plugin/oneiric
Diff against target: 74 lines (+41/-6)
1 file modified
src/grid.cpp (+41/-6)
To merge this branch: bzr merge lp:~smspillaz/compiz-grid-plugin/oneiric.fix_796594
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+77315@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Use actual semi-maximization when resizing windows

Revision history for this message
Jason Smith (jassmith) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/grid.cpp'
2--- src/grid.cpp 2011-09-27 15:50:51 +0000
3+++ src/grid.cpp 2011-09-28 12:26:26 +0000
4@@ -339,13 +339,41 @@
5 /* TODO: animate move+resize */
6 if (resize)
7 {
8- cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
9- gw->isGridResized = true;
10- gw->isGridMaximized = false;
11- for (unsigned int i = 0; i < animations.size (); i++)
12- animations.at (i).fadingOut = true;
13+ unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
14 gw->lastTarget = where;
15 gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height);
16+
17+ /* Special case for left and right, actually vertically maximize
18+ * the window */
19+ if (where == GridLeft || where == GridRight)
20+ {
21+ /* First restore the window to its original size */
22+ XWindowChanges rwc;
23+
24+ rwc.x = gw->originalSize.x ();
25+ rwc.y = gw->originalSize.y ();
26+ rwc.width = gw->originalSize.width ();
27+ rwc.height = gw->originalSize.height ();
28+
29+ cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &rwc);
30+
31+ gw->isGridMaximized = true;
32+ gw->isGridResized = false;
33+
34+ /* Maximize the window */
35+ cw->maximize (CompWindowStateMaximizedVertMask);
36+ }
37+ else
38+ {
39+ gw->isGridResized = true;
40+ gw->isGridMaximized = false;
41+ }
42+
43+ /* Make window the size that we want */
44+ cw->configureXWindow (valueMask, &xwc);
45+
46+ for (unsigned int i = 0; i < animations.size (); i++)
47+ animations.at (i).fadingOut = true;
48 }
49
50 /* This centers a window if it could not be resized to the desired
51@@ -672,7 +700,7 @@
52 gScreen->mGrabWindow = window;
53 pointerBufDx = pointerBufDy = 0;
54
55- if (!isGridResized && gScreen->optionGetSnapbackWindows ())
56+ if (!isGridResized && !isGridMaximized && gScreen->optionGetSnapbackWindows ())
57 /* Store size not including borders when grabbing with cursor */
58 originalSize = gScreen->slotToRect(window,
59 window->serverBorderRect ());
60@@ -738,7 +766,14 @@
61 lastTarget = GridUnknown;
62 else if (!(lastState & MAXIMIZE_STATE) &&
63 window->state () & MAXIMIZE_STATE)
64+ {
65 lastTarget = GridMaximize;
66+ if (window->grabbed ())
67+ {
68+ originalSize = gScreen->slotToRect (window,
69+ window->serverBorderRect ());
70+ }
71+ }
72
73 window->stateChangeNotify (lastState);
74 }

Subscribers

People subscribed via source and target branches