Merge lp:~compiz-team/compiz-core/compiz-core.fix_864478 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2854
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.fix_864478
Merge into: lp:compiz-core/0.9.5
Diff against target: 299 lines (+78/-54)
3 files modified
plugins/decor/src/decor.cpp (+7/-6)
src/event.cpp (+3/-2)
src/window.cpp (+68/-46)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.fix_864478
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+77807@code.launchpad.net

Description of the change

Rework the window shading system a bit.

There were a few changes in core to integrate better with window re-parenting which broke
the old method of doing shading. Now we update the shade state of the window when the window
is actually unmapped due to a shade and also ensure that the frame window is the right size
without touching the geometry of the client (such that CompWindow::geometry is representative
of the actual client geometry).

Also use the input extents last sent to server as a means to determine whether or not
window shading should be allowed rather than the extents last received as we don't update
the allowed window actions on input extents ConfigureNotify.

Fix LP#864478

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) wrote :

Wheeeeeeeeeeeeeeeeeeeeeeeeeeeeee

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/decor/src/decor.cpp'
2--- plugins/decor/src/decor.cpp 2011-09-30 04:54:21 +0000
3+++ plugins/decor/src/decor.cpp 2011-10-02 07:28:08 +0000
4@@ -259,8 +259,6 @@
5 if (wd &&
6 wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP)
7 {
8-
9-
10 CompRect box;
11 GLTexture::MatrixList ml (1);
12 mask |= PAINT_WINDOW_BLEND_MASK;
13@@ -1019,10 +1017,13 @@
14 for (i = 0; i < wd->nQuad; i++)
15 {
16 int x, y;
17-
18- /* Recompute scaled quad box */
19- computeQuadBox (&wd->decor->quad[i], window->size ().width (),
20- window->size ().height (),
21+ unsigned int width = window->size ().width ();
22+ unsigned int height = window->size ().height ();
23+
24+ if (window->shaded ())
25+ height = 0;
26+
27+ computeQuadBox (&wd->decor->quad[i], width, height,
28 &x1, &y1, &x2, &y2, &sx, &sy);
29
30 /* Translate by x and y points of this window */
31
32=== modified file 'src/event.cpp'
33--- src/event.cpp 2011-09-19 13:00:51 +0000
34+++ src/event.cpp 2011-10-02 07:28:08 +0000
35@@ -1831,7 +1831,7 @@
36 * and the passive button grabs and then we will
37 * get the DestroyNotify later and change the focus
38 * there
39- */
40+ */
41
42 if (wa.root == priv->root)
43 {
44@@ -1845,7 +1845,6 @@
45 if (w->id () != priv->activeWindow)
46 {
47 CompWindow *active = screen->findWindow (priv->activeWindow);
48- w->windowNotify (CompWindowNotifyFocusChange);
49
50 priv->activeWindow = w->id ();
51 w->priv->activeNum = priv->activeNum++;
52@@ -1861,6 +1860,8 @@
53 Atoms::winActive,
54 XA_WINDOW, 32, PropModeReplace,
55 (unsigned char *) &priv->activeWindow, 1);
56+
57+ w->windowNotify (CompWindowNotifyFocusChange);
58 }
59
60 state &= ~CompWindowStateDemandsAttentionMask;
61
62=== modified file 'src/window.cpp'
63--- src/window.cpp 2011-09-30 04:54:21 +0000
64+++ src/window.cpp 2011-10-02 07:28:08 +0000
65@@ -604,7 +604,7 @@
66 break;
67 }
68
69- if (priv->input.top)
70+ if (priv->serverInput.top)
71 actions |= CompWindowActionShadeMask;
72
73 actions |= (CompWindowActionAboveMask | CompWindowActionBelowMask);
74@@ -813,7 +813,10 @@
75 xwc.x = serverGeometry.x () - serverInput.left;
76 xwc.y = serverGeometry.y () - serverInput.top;
77 xwc.width = serverGeometry.width () + serverInput.left + serverInput.right + bw;
78- xwc.height = serverGeometry.height () + serverInput.top + serverInput.bottom + bw;
79+ if (shaded)
80+ xwc.height = serverInput.top + serverInput.bottom + bw;
81+ else
82+ xwc.height = serverGeometry.height () + serverInput.top + serverInput.bottom + bw;
83
84 if (shaded)
85 height = serverInput.top + serverInput.bottom;
86@@ -905,6 +908,7 @@
87 }
88 else
89 XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc);
90+
91 if (shaded)
92 {
93 XUnmapWindow (screen->dpy (), wrapper);
94@@ -927,7 +931,13 @@
95 xwc.x = serverGeometry.x ();
96 xwc.y = serverGeometry.y ();
97 xwc.width = serverGeometry.width () + bw;
98- xwc.height = serverGeometry.height () + bw;
99+
100+ /* FIXME: It doesn't make much sense to allow undecorated windows to be
101+ * shaded */
102+ if (shaded)
103+ xwc.height = bw;
104+ else
105+ xwc.height = bw;
106
107 if (shaded)
108 height = 0;
109@@ -1132,10 +1142,10 @@
110
111 }
112
113- r.x = -priv->attrib.border_width;
114- r.y = -priv->attrib.border_width;
115- r.width = priv->width + priv->attrib.border_width;
116- r.height = priv->height + priv->attrib.border_width;
117+ r.x = -priv->geometry.border ();
118+ r.y = -priv->geometry.border ();
119+ r.width = priv->width + priv->geometry.border ();
120+ r.height = priv->height + priv->geometry.border ();
121
122 if (nBounding < 1)
123 {
124@@ -1607,11 +1617,10 @@
125 if (!overrideRedirect ())
126 {
127 /* been shaded */
128- if (!priv->height)
129+ if (priv->shaded)
130 {
131- priv->geometry.setHeight (priv->geometry.height () + 1);
132- resize (priv->geometry.x (), priv->geometry.y (), priv->geometry.width (),
133- priv->geometry.height () - 1, priv->geometry.border ());
134+ priv->shaded = false;
135+ priv->updateFrameWindow ();
136 }
137 }
138 }
139@@ -1637,10 +1646,12 @@
140 * pixmap of the window around, it's safe to
141 * unmap the frame window since there's no use
142 * for it at this point anyways and it just blocks
143- * input */
144+ * input, but keep it around if shaded */
145
146 XUnmapWindow (screen->dpy (), priv->wrapper);
147- XUnmapWindow (screen->dpy (), priv->serverFrame);
148+
149+ if (!priv->shaded)
150+ XUnmapWindow (screen->dpy (), priv->serverFrame);
151
152 priv->unmapRefCnt--;
153 if (priv->unmapRefCnt > 0)
154@@ -1668,7 +1679,7 @@
155 priv->unmanaging = false;
156 }
157
158- if (priv->serverFrame)
159+ if (priv->serverFrame && !priv->shaded)
160 priv->unreparent ();
161
162 if (priv->struts)
163@@ -1681,13 +1692,12 @@
164 screen->priv->desktopWindowCount--;
165
166 priv->attrib.map_state = IsUnmapped;
167-
168 priv->invisible = true;
169
170 if (priv->shaded && priv->height)
171- resize (priv->attrib.x, priv->attrib.y,
172- priv->attrib.width, ++priv->attrib.height - 1,
173- priv->attrib.border_width);
174+ {
175+ priv->updateFrameWindow ();
176+ }
177
178 screen->priv->updateClientList ();
179
180@@ -1792,9 +1802,6 @@
181 pw = gm.width () + gm.border () * 2;
182 ph = gm.height () + gm.border () * 2;
183
184- if (priv->shaded)
185- ph = 0;
186-
187 dx = gm.x () - priv->geometry.x ();
188 dy = gm.y () - priv->geometry.y ();
189 dwidth = gm.width () - priv->geometry.width ();
190@@ -2111,7 +2118,15 @@
191 x = ce->x + priv->serverInput.left;
192 y = ce->y + priv->serverInput.top;
193 width = ce->width - priv->serverGeometry.border () * 2 - priv->serverInput.left - priv->serverInput.right;
194- height = ce->height - priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom;
195+
196+ /* Don't use the server side frame geometry
197+ * to determine the geometry of shaded
198+ * windows since we didn't resize them
199+ * on configureXWindow */
200+ if (priv->shaded)
201+ height = priv->serverGeometry.height () - priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom;
202+ else
203+ height = ce->height - priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom;
204
205 /* set the frame geometry */
206 priv->frameGeometry.set (ce->x, ce->y, ce->width, ce->height, ce->border_width);
207@@ -3175,9 +3190,22 @@
208 + serverInput.left + serverInput.right)
209 frameValueMask &= ~(CWWidth);
210
211- if (serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2
212- + serverInput.top + serverInput.bottom)
213- frameValueMask &= ~(CWHeight);
214+ /* shaded windows are not allowed to have their frame window
215+ * height changed (but are allowed to have their client height
216+ * changed */
217+
218+ if (shaded)
219+ {
220+ if (serverFrameGeometry.height () == serverGeometry.border () * 2
221+ + serverInput.top + serverInput.bottom)
222+ frameValueMask &= ~(CWHeight);
223+ }
224+ else
225+ {
226+ if (serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2
227+ + serverInput.top + serverInput.bottom)
228+ frameValueMask &= ~(CWHeight);
229+ }
230
231 /* Can't set the border width of frame windows */
232 frameValueMask &= ~(CWBorderWidth);
233@@ -3192,9 +3220,18 @@
234 serverFrameGeometry.setWidth (xwc->width + serverGeometry.border () * 2
235 + serverInput.left + serverInput.right);
236
237- if (frameValueMask & CWHeight)
238- serverFrameGeometry.setHeight (xwc->height + serverGeometry.border () * 2
239- + serverInput.top + serverInput.bottom);
240+ if (shaded)
241+ {
242+ if (frameValueMask & CWHeight)
243+ serverFrameGeometry.setHeight (serverGeometry.border () * 2
244+ + serverInput.top + serverInput.bottom);
245+ }
246+ else
247+ {
248+ if (frameValueMask & CWHeight)
249+ serverFrameGeometry.setHeight (xwc->height + serverGeometry.border () * 2
250+ + serverInput.top + serverInput.bottom);
251+ }
252
253
254 if (serverFrame)
255@@ -4217,7 +4254,7 @@
256 if (overrideRedirect () || !priv->managed)
257 return;
258
259- if (priv->state & CompWindowStateShadedMask)
260+ if (priv->state & CompWindowStateShadedMask && !priv->shaded)
261 {
262 windowNotify (CompWindowNotifyShade);
263
264@@ -4627,20 +4664,10 @@
265 if (serverFrame)
266 XMapWindow (screen->dpy (), serverFrame);
267
268- if (height)
269- {
270- priv->geometry.setHeight (priv->geometry.height () + 1);
271- window->resize (geometry.x (), geometry.y (),
272- geometry.width (), geometry.height () - 1,
273- geometry.border ());
274- }
275+ updateFrameWindow ();
276
277 return;
278 }
279- else
280- {
281- shaded = false;
282- }
283
284 window->windowNotify (CompWindowNotifyShow);
285
286@@ -6266,12 +6293,7 @@
287 priv->updateIconGeometry ();
288
289 if (priv->shaded)
290- {
291- priv->geometry.setHeight (priv->geometry.height () + 1);
292- resize (priv->geometry.x (), priv->geometry.y (),
293- priv->geometry.width (), priv->geometry.height () - 1,
294- priv->geometry.border ());
295- }
296+ priv->updateFrameWindow ();
297
298 if (priv->attrib.map_state == IsViewable)
299 {

Subscribers

People subscribed via source and target branches