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

Proposed by Sam Spilsbury
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 3635
Merged at revision: 3635
Proposed branch: lp:~compiz-team/compiz/raring.fix_1138517
Merge into: lp:compiz/raring
Diff against target: 409 lines (+227/-45)
4 files modified
plugins/decor/src/decor.cpp (+38/-22)
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/raring.fix_1138517
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Timo Jyrinki Approve
Andrea Azzarone Approve
Review via email: mp+152622@code.launchpad.net

This proposal supersedes a proposal from 2013-03-06.

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
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3633
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~compiz-team/compiz/raring.fix_1138517/+merge/151940/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/compiz-ci/106/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/compiz-gles-ci/./build=pbuilder,distribution=raring,flavor=amd64/143/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/compiz-pbuilder/./build=pbuilder,distribution=raring,flavor=amd64/495/console

Click here to trigger a rebuild:
http://jenkins.qa.ubuntu.com/job/compiz-ci/106//rebuild/?

review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote : Posted in a previous version of this proposal

Not sure what was jenkins' problem, but this branch has the same issue of non-moveable/resizeable Java windows as https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1138517/+merge/151941

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Timo, does it works now?

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

*work

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

Yes, compiled this one and it works now (tested with jEdit and a hello world app).

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

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

Subscribers

People subscribed via source and target branches

to all changes: