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

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 91
Proposed branch: lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement
Merge into: lp:~compiz-team/compiz-grid-plugin/oneiric
Diff against target: 197 lines (+53/-43)
2 files modified
src/grid.cpp (+49/-40)
src/grid.h (+4/-3)
To merge this branch: bzr merge lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+77881@code.launchpad.net

This proposal supersedes a proposal from 2011-10-03.

Description of the change

Bug 865177
Bug 865179

Don't shift windows about on CompWindowNotifyFrameUpdate, it could be possible that there are pending configure requests. Instead, shift the window by the updated border geometry after maximizing it.

Also don't allow windows that set custom size hints to mess up positioning.

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) 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/grid.cpp'
2--- src/grid.cpp 2011-09-29 11:18:56 +0000
3+++ src/grid.cpp 2011-10-03 09:50:29 +0000
4@@ -214,7 +214,13 @@
5 desiredSlot.setWidth (workarea.width () / props.numCellsX);
6
7 /* Adjust for constraints and decorations */
8- desiredRect = constrainSize (cw, desiredSlot);
9+ if (where & ~(GridMaximize | GridLeft | GridRight))
10+ {
11+ desiredRect = constrainSize (cw, desiredSlot);
12+ }
13+ else
14+ desiredRect = slotToRect (cw, desiredSlot);
15+
16 /* Get current rect not including decorations */
17 currentRect.setGeometry (cw->serverX (), cw->serverY (),
18 cw->serverWidth (),
19@@ -222,7 +228,7 @@
20
21 if (desiredRect.y () == currentRect.y () &&
22 desiredRect.height () == currentRect.height () &&
23- where & ~(GridMaximize) && gw->lastTarget & where)
24+ where & ~(GridMaximize | GridLeft | GridRight) && gw->lastTarget & where)
25 {
26 int slotWidth25 = workarea.width () / 4;
27 int slotWidth33 = (workarea.width () / 3) + cw->border ().left;
28@@ -338,6 +344,9 @@
29 unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
30 gw->lastTarget = where;
31 gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height);
32+ CompWindowExtents lastBorder = gw->window->border ();
33+
34+ gw->sizeHintsFlags = 0;
35
36 /* Special case for left and right, actually vertically maximize
37 * the window */
38@@ -356,10 +365,15 @@
39 gw->isGridMaximized = true;
40 gw->isGridResized = false;
41
42- gw->lastBorder = cw->border ();
43 /* Maximize the window */
44- printf ("maximizing window\n");
45 cw->maximize (CompWindowStateMaximizedVertMask);
46+
47+ /* Be evil */
48+ if (cw->sizeHints ().flags & PResizeInc)
49+ {
50+ gw->sizeHintsFlags |= PResizeInc;
51+ gw->window->sizeHints ().flags &= ~(PResizeInc);
52+ }
53 }
54 else
55 {
56@@ -367,6 +381,17 @@
57 gw->isGridMaximized = false;
58 }
59
60+ int dw = (lastBorder.left + lastBorder.right) -
61+ (gw->window->border ().left +
62+ gw->window->border ().right);
63+
64+ int dh = (lastBorder.top + lastBorder.bottom) -
65+ (gw->window->border ().top +
66+ gw->window->border ().bottom);
67+
68+ xwc.width += dw;
69+ xwc.height += dh;
70+
71 /* Make window the size that we want */
72 cw->configureXWindow (valueMask, &xwc);
73
74@@ -718,6 +743,21 @@
75 }
76
77 void
78+GridWindow::validateResizeRequest (unsigned int &xwcm,
79+ XWindowChanges *xwc,
80+ unsigned int source)
81+{
82+ window->validateResizeRequest (xwcm, xwc, source);
83+
84+ /* Don't allow non-pagers to change
85+ * the size of the window, the user
86+ * specified this size, thank-you */
87+ if (isGridMaximized)
88+ if (source != ClientTypePager)
89+ xwcm = 0;
90+}
91+
92+void
93 GridWindow::grabNotify (int x,
94 int y,
95 unsigned int state,
96@@ -787,8 +827,6 @@
97 dx = currentSize.x () - window->geometry ().x ();
98 dy = currentSize.y () - window->geometry ().y ();
99
100- printf ("offset move\n");
101-
102 window->move (dx, dy);
103 }
104 }
105@@ -813,37 +851,6 @@
106 window->stateChangeNotify (lastState);
107 }
108
109-void
110-GridWindow::windowNotify (CompWindowNotify n)
111-{
112- if (n == CompWindowNotifyFrameUpdate)
113- {
114- if (isGridMaximized && !((window->state () & MAXIMIZE_STATE) == MAXIMIZE_STATE))
115- {
116- unsigned int valueMask = 0;
117- XWindowChanges xwc;
118-
119- int dw = (lastBorder.left + lastBorder.right) -
120- (window->border ().left + window->border ().right);
121-
122- int dh = (lastBorder.top + lastBorder.bottom) -
123- (window->border ().top + window->border ().bottom);
124-
125- if (dw != 0)
126- valueMask |= CWWidth;
127- if (dh != 0)
128- valueMask |= CWHeight;
129- xwc.width = window->serverGeometry ().width () + dw;
130- xwc.height = window->serverGeometry ().height () + dh;
131-
132- window->configureXWindow (valueMask, &xwc);
133- }
134-
135- lastBorder = window->border ();
136- }
137-
138- window->windowNotify (n);
139-}
140 bool
141 GridScreen::restoreWindow (CompAction *action,
142 CompAction::State state,
143@@ -861,7 +868,10 @@
144 return false;
145
146 if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE))
147- gw->isGridMaximized = false;
148+ {
149+ gw->window->sizeHints ().flags |= gw->sizeHintsFlags;
150+ gw->isGridMaximized = false;
151+ }
152 else
153 {
154 if (cw == mGrabWindow)
155@@ -878,7 +888,6 @@
156 xwc.height = gw->originalSize.height ();
157 cw->maximize (0);
158 gw->currentSize = CompRect ();
159- printf ("attempting snapBack\n");
160 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
161 gw->pointerBufDx = 0;
162 gw->pointerBufDy = 0;
163@@ -1045,7 +1054,7 @@
164 grabMask (0),
165 pointerBufDx (0),
166 pointerBufDy (0),
167- resizeCount (0),
168+ resizeCount (0),
169 lastTarget (GridUnknown)
170 {
171 WindowInterface::setHandler (window);
172
173=== modified file 'src/grid.h'
174--- src/grid.h 2011-09-29 11:18:56 +0000
175+++ src/grid.h 2011-10-03 09:50:29 +0000
176@@ -169,8 +169,8 @@
177 int resizeCount;
178 CompRect currentSize;
179 CompRect originalSize;
180- CompWindowExtents lastBorder;
181 GridType lastTarget;
182+ unsigned int sizeHintsFlags;
183
184 void grabNotify (int, int, unsigned int, unsigned int);
185
186@@ -179,8 +179,9 @@
187 void moveNotify (int, int, bool);
188
189 void stateChangeNotify (unsigned int);
190-
191- void windowNotify (CompWindowNotify n);
192+ void validateResizeRequest (unsigned int &valueMask,
193+ XWindowChanges *xwc,
194+ unsigned int source);
195 };
196
197 #define GRID_WINDOW(w) \

Subscribers

People subscribed via source and target branches