Merge lp:~compiz-team/compiz/compiz.fix_1138517 into lp:compiz/0.9.9

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1138517
Merge into: lp:compiz/0.9.9
Diff against target: 393 lines (+219/-44)
4 files modified
plugins/decor/src/decor.cpp (+30/-21)
src/privatewindow.h (+2/-2)
src/window.cpp (+27/-10)
tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp (+160/-11)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1138517
Reviewer Review Type Date Requested Status
Andrea Azzarone Abstain
Timo Jyrinki Needs Fixing
MC Return Approve
Review via email: mp+151941@code.launchpad.net

This proposal has been superseded by a proposal from 2013-03-11.

Commit message

Don't set lastFrameExtents unless the window geometry actually changed - as
that variable only exists to track changes in the actual geometry of
the window and not the apparant frame extents.

Added tests to verify that behaviour.

(LP: #1138517)

Description of the change

Don't set lastFrameExtents unless the window geometry actually changed - as
that variable only exists to track changes in the actual geometry of
the window and not the apparant frame extents.

Added tests to verify that behaviour.

(LP: #1138517)

To post a comment you must log in.
Revision history for this message
MC Return (mc-return) wrote :

+1.

review: Approve
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

With this branch I couldn't resize or move Java windows (like jEdit) anymore. Reverting to the archive fixed the issue.

review: Disapprove
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I'm sure you meant "needs fixing" not disapprove. In any case I can have
another look into it. I didn't test with jedit but java is such a bloody
disaster that I'm not even sure I care anymore.
On 11/03/2013 1:39 PM, "Timo Jyrinki" <email address hidden> wrote:

> Review: Disapprove
>
> With this branch I couldn't resize or move Java windows (like jEdit)
> anymore. Reverting to the archive fixed the issue.
> --
>
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1138517/+merge/151941
> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

(or: Needs Fixing .. the problematic bzr 3616 was already reverted, but of course a proper fix could be nicer anyhow so that the 3616 could be resubmitted)

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Sure, Needs Fixing it is.

review: Needs Fixing
3632. By Sam Spilsbury

Only set the decoration if we actually meant to decorate the window.

This allows us to set frame extents and not set the whole decoration
property

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Ops wrong branch.

Revision history for this message
Andrea Azzarone (azzar1) :
review: Abstain

Unmerged revisions

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 2013-02-26 01:08:15 +0000
3+++ plugins/decor/src/decor.cpp 2013-03-11 06:34:23 +0000
4@@ -1585,35 +1585,44 @@
5 */
6 if (decoration)
7 {
8- wd = WindowDecoration::create (decoration);
9- if (!wd)
10- return false;
11-
12 /* Set extents based on maximize/unmaximize state
13 * FIXME: With the new type system, this should be
14 * removed */
15 if ((window->state () & MAXIMIZE_STATE))
16- window->setWindowFrameExtents (&wd->decor->maxBorder,
17- &wd->decor->maxInput);
18+ window->setWindowFrameExtents (&decoration->maxBorder,
19+ &decoration->maxInput);
20 else if (!window->hasUnmapReference ())
21- window->setWindowFrameExtents (&wd->decor->border,
22- &wd->decor->input);
23-
24- movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
25- movement -= oldShift;
26-
27- /* Update the input and output frame */
28+ window->setWindowFrameExtents (&decoration->border,
29+ &decoration->input);
30+
31+ /* We actually need to decorate this window */
32 if (decorate)
33+ {
34+ wd = WindowDecoration::create (decoration);
35+ if (!wd)
36+ {
37+ /* Error condition, reset frame extents */
38+ CompWindowExtents emptyExtents;
39+ memset (&emptyExtents, 0, sizeof (CompWindowExtents));
40+ window->setWindowFrameExtents (&emptyExtents, &emptyExtents);
41+ return false;
42+ }
43+
44+ movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
45+ movement -= oldShift;
46+
47+ /* Update the input and output frame */
48 updateFrame ();
49- window->updateWindowOutputExtents ();
50+ window->updateWindowOutputExtents ();
51
52- updateReg = true;
53- updateMatrix = true;
54- mOutputRegion = CompRegion (window->outputRect ());
55- updateGroupShadows ();
56- if (dScreen->cmActive)
57- cWindow->damageOutputExtents ();
58- updateDecorationScale ();
59+ updateReg = true;
60+ updateMatrix = true;
61+ mOutputRegion = CompRegion (window->outputRect ());
62+ updateGroupShadows ();
63+ if (dScreen->cmActive)
64+ cWindow->damageOutputExtents ();
65+ updateDecorationScale ();
66+ }
67 }
68 else
69 {
70
71=== modified file 'src/privatewindow.h'
72--- src/privatewindow.h 2013-02-10 05:01:50 +0000
73+++ src/privatewindow.h 2013-03-11 06:34:23 +0000
74@@ -155,7 +155,7 @@
75
76 void recalcNormalHints ();
77
78- void updateFrameWindow ();
79+ bool updateFrameWindow ();
80
81 void setWindowMatrix ();
82
83@@ -302,7 +302,7 @@
84 int gravity,
85 int direction);
86
87- void updateSize ();
88+ bool updateSize ();
89
90 bool getUserTime (Time& time);
91 void setUserTime (Time time);
92
93=== modified file 'src/window.cpp'
94--- src/window.cpp 2013-02-27 03:24:45 +0000
95+++ src/window.cpp 2013-03-11 06:34:23 +0000
96@@ -807,12 +807,11 @@
97 priv->type = type;
98 }
99
100-
101-void
102+bool
103 PrivateWindow::updateFrameWindow ()
104 {
105 if (!serverFrame)
106- return;
107+ return false;
108
109 XWindowChanges xwc = XWINDOWCHANGES_INIT;
110 unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
111@@ -826,6 +825,8 @@
112 window->configureXWindow (valueMask, &xwc);
113 window->windowNotify (CompWindowNotifyFrameUpdate);
114 window->recalcActions ();
115+
116+ return true;
117 }
118
119
120@@ -4109,11 +4110,11 @@
121 priv->placed = true;
122 }
123
124-void
125+bool
126 PrivateWindow::updateSize ()
127 {
128 if (window->overrideRedirect () || !managed)
129- return;
130+ return false;
131
132 XWindowChanges xwc = XWINDOWCHANGES_INIT;
133
134@@ -4124,7 +4125,10 @@
135 window->sendSyncRequest ();
136
137 window->configureXWindow (mask, &xwc);
138+ return true;
139 }
140+
141+ return false;
142 }
143
144 int
145@@ -6780,8 +6784,10 @@
146
147 recalcActions ();
148
149- priv->updateSize ();
150- priv->updateFrameWindow ();
151+ bool sizeUpdated = false;
152+
153+ sizeUpdated |= priv->updateSize ();
154+ sizeUpdated |= priv->updateFrameWindow ();
155
156 /* Always send a moveNotify
157 * whenever the frame extents update
158@@ -6789,7 +6795,8 @@
159 moveNotify (0, 0, true);
160
161 /* Once we have updated everything, re-set lastServerInput */
162- priv->lastServerInput = priv->serverInput;
163+ if (sizeUpdated)
164+ priv->lastServerInput = priv->serverInput;
165 }
166
167 /* Use b for _NET_WM_FRAME_EXTENTS here because
168@@ -6909,6 +6916,9 @@
169 * but that's all */
170 XSelectInput (dpy, screen->root (), SubstructureNotifyMask);
171
172+ /* Gravity here is assumed to be SouthEast, clients can update
173+ * that if need be */
174+
175 /* Awaiting a new frame to be given to us */
176 frame = None;
177 serverFrame = XCreateWindow (dpy, screen->root (), 0, 0,
178@@ -6918,10 +6928,17 @@
179 /* Do not get any events from here on */
180 XSelectInput (dpy, screen->root (), NoEventMask);
181
182- wrapper = XCreateWindow (dpy, serverFrame, 0, 0,
183- wa.width, wa.height, 0, wa.depth,
184+ /* If we have some frame extents, we should apply them here and
185+ * set lastFrameExtents */
186+ wrapper = XCreateWindow (dpy, serverFrame,
187+ serverInput.left, serverInput.top,
188+ wa.width - (serverInput.left + serverInput.right),
189+ wa.height - (serverInput.top + serverInput.bottom),
190+ 0, wa.depth,
191 InputOutput, visual, mask, &attr);
192
193+ lastServerInput = serverInput;
194+
195 xwc.stack_mode = Above;
196
197 /* Look for the client in the current server side stacking
198
199=== modified file 'tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp'
200--- tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-02-26 00:52:32 +0000
201+++ tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-03-11 06:34:23 +0000
202@@ -55,27 +55,41 @@
203 return ct::AdvanceToNextEventOnSuccess (d, r);
204 }
205
206+Window GetImmediateParent (Display *display,
207+ Window w,
208+ Window &rootReturn)
209+{
210+ Window parentReturn = w;
211+ Window *childrenReturn;
212+ unsigned int nChildrenReturn;
213+
214+ XQueryTree (display,
215+ w,
216+ &rootReturn,
217+ &parentReturn,
218+ &childrenReturn,
219+ &nChildrenReturn);
220+ XFree (childrenReturn);
221+
222+ return parentReturn;
223+}
224+
225+
226 Window GetTopParent (Display *display,
227 Window w)
228 {
229- Window rootReturn;
230+ Window rootReturn = 0;
231 Window parentReturn = w;
232- Window *childrenReturn;
233- unsigned int nChildrenReturn;
234-
235 Window lastParent = 0;
236
237 do
238 {
239 lastParent = parentReturn;
240
241- XQueryTree (display,
242- lastParent,
243- &rootReturn,
244- &parentReturn,
245- &childrenReturn,
246- &nChildrenReturn);
247- XFree (childrenReturn);
248+ parentReturn = GetImmediateParent (display,
249+ lastParent,
250+ rootReturn);
251+
252 } while (parentReturn != rootReturn);
253
254 return lastParent;
255@@ -565,3 +579,138 @@
256 currentWidth + (left + right),
257 currentHeight + (top + bottom)));
258 }
259+
260+TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsUnmapped)
261+{
262+ ::Display *dpy = Display ();
263+
264+ Window client = ct::CreateNormalWindow (dpy);
265+ WaitForWindowCreation (client);
266+
267+ /* Set frame extents and get a response */
268+ int left = 1;
269+ int right = 1;
270+ int top = 1;
271+ int bottom = 1;
272+
273+ int currentX, currentY;
274+ unsigned int currentWidth, currentHeight;
275+ ASSERT_TRUE (QueryGeometry (dpy,
276+ client,
277+ currentX,
278+ currentY,
279+ currentWidth,
280+ currentHeight));
281+
282+ /* We should get a response with our frame extents but it shouldn't actually
283+ * do anything to the client as it is unmapped */
284+ SendSetFrameExtentsRequest (client, left, right, top, bottom);
285+ ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));
286+
287+ ASSERT_TRUE (VerifyWindowSize (client,
288+ currentX,
289+ currentY,
290+ currentWidth,
291+ currentHeight));
292+}
293+
294+TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsCorrectMapBehaviour)
295+{
296+ ::Display *dpy = Display ();
297+
298+ Window client = ct::CreateNormalWindow (dpy);
299+ WaitForWindowCreation (client);
300+
301+ /* Set frame extents and get a response */
302+ int left = 1;
303+ int right = 1;
304+ int top = 1;
305+ int bottom = 1;
306+
307+ int currentX, currentY;
308+ unsigned int currentWidth, currentHeight;
309+ ASSERT_TRUE (QueryGeometry (dpy,
310+ client,
311+ currentX,
312+ currentY,
313+ currentWidth,
314+ currentHeight));
315+
316+ SendSetFrameExtentsRequest (client, left, right, top, bottom);
317+ ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));
318+
319+ /* Map the window */
320+ XMapRaised (dpy, client);
321+ WaitForReparentAndMap (dpy, client);
322+
323+ /* Check the geometry of the frame */
324+ Window frame = GetTopParent (dpy, client);
325+ ASSERT_TRUE (VerifyWindowSize (frame,
326+ currentX,
327+ currentY,
328+ currentWidth + (left + right),
329+ currentHeight + (top + bottom)));
330+
331+ /* Wrapper geometry is extents.xy, size.wh */
332+ Window root;
333+ Window wrapper = GetImmediateParent (dpy, client, root);
334+ ASSERT_TRUE (VerifyWindowSize (wrapper,
335+ left,
336+ top,
337+ currentWidth,
338+ currentHeight));
339+}
340+
341+TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsConsistentBehaviourAfterMap)
342+{
343+ ::Display *dpy = Display ();
344+
345+ Window client = ct::CreateNormalWindow (dpy);
346+ WaitForWindowCreation (client);
347+
348+ /* Set frame extents and get a response */
349+ int left = 1;
350+ int right = 1;
351+ int top = 1;
352+ int bottom = 1;
353+
354+ int currentX, currentY;
355+ unsigned int currentWidth, currentHeight;
356+ ASSERT_TRUE (QueryGeometry (dpy,
357+ client,
358+ currentX,
359+ currentY,
360+ currentWidth,
361+ currentHeight));
362+
363+ SendSetFrameExtentsRequest (client, left, right, top, bottom);
364+ ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));
365+
366+ /* Map the window */
367+ XMapRaised (dpy, client);
368+ WaitForReparentAndMap (dpy, client);
369+
370+ /* Send it another frame extents request */
371+ right = right + 1;
372+ bottom = bottom + 1;
373+
374+ SendSetFrameExtentsRequest (client, left, right, top, bottom);
375+ ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));
376+
377+ /* Check the geometry of the frame */
378+ Window frame = GetTopParent (dpy, client);
379+ ASSERT_TRUE (VerifyWindowSize (frame,
380+ currentX,
381+ currentY,
382+ currentWidth + (left + right),
383+ currentHeight + (top + bottom)));
384+
385+ /* Wrapper geometry is extents.xy, size.wh */
386+ Window root;
387+ Window wrapper = GetImmediateParent (dpy, client, root);
388+ ASSERT_TRUE (VerifyWindowSize (wrapper,
389+ left,
390+ top,
391+ currentWidth,
392+ currentHeight));
393+}

Subscribers

People subscribed via source and target branches