Merge lp:~smspillaz/compiz-core/compiz-core.fix_878934 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2896
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_878934
Merge into: lp:compiz-core/0.9.5
Diff against target: 204 lines (+60/-33)
4 files modified
plugins/decor/src/decor.cpp (+30/-13)
plugins/decor/src/decor.h (+2/-0)
po/POTFILES.in (+0/-3)
src/window.cpp (+28/-17)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_878934
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+85806@code.launchpad.net

Description of the change

Fixes incorrect _NET_REQUEST_FRAME_EXTENTS handling.

Previously, we would not allow any window to be decorated if it was not yet reparented, eg if a window as pending a map. However, clients are supposed to request frame extents before the window is mapped, so we need to generate a decoration (even if it is a default one) for the window as soon as we get a _NET_REQUEST_FRAME_EXTENTS client message so we can set the _NET_FRAME_EXTENTS property on the window immediately.

Also, we should always set the _NET_FRAME_EXTENTS property on the window, even if the window does not receive a frame (but a plugin has indicated that it is *capable* of receiving one, eg an initially undecorated window in the decor plugin). Some clients require that the property is set in response to _NET_REQUEST_FRAME_EXTENTS, even if they are 0, 0, 0, 0

Fixes bug 878934

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Revision history for this message
Gord Allott (gordallott) wrote :

On 15/12/11 08:06, Sam Spilsbury wrote:
> Sam Spilsbury has proposed merging lp:~smspillaz/compiz-core/compiz-core.fix_878934 into lp:compiz-core.
>
> Requested reviews:
> Compiz Maintainers (compiz-team)
> Related bugs:
> Bug #878934 in compiz (Ubuntu): "Menu selection is wrong in Java apps"
> https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/878934
>
> For more details, see:
> https://code.launchpad.net/~smspillaz/compiz-core/compiz-core.fix_878934/+merge/85806
>
> Fixes incorrect _NET_REQUEST_FRAME_EXTENTS handling.
>
> Previously, we would not allow any window to be decorated if it was not yet reparented, eg if a window as pending a map. However, clients are supposed to request frame extents before the window is mapped, so we need to generate a decoration (even if it is a default one) for the window as soon as we get a _NET_REQUEST_FRAME_EXTENTS client message so we can set the _NET_FRAME_EXTENTS property on the window immediately.
>
> Also, we should always set the _NET_FRAME_EXTENTS property on the window, even if the window does not receive a frame (but a plugin has indicated that it is *capable* of receiving one, eg an initially undecorated window in the decor plugin). Some clients require that the property is set in response to _NET_REQUEST_FRAME_EXTENTS, even if they are 0, 0, 0, 0
>
> Fixes bug 878934

Code seems fine, but untested

review approve

--
Gordon Allott
Canonical Ltd.
27 Floor, Millbank Tower
London SW1P 4QP
www.canonical.com

Revision history for this message
Gord Allott (gordallott) :
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-10-26 23:18:47 +0000
3+++ plugins/decor/src/decor.cpp 2011-12-15 08:04:24 +0000
4@@ -1384,6 +1384,7 @@
5 {
6 Decoration *old, *decoration = NULL;
7 bool decorate = false;
8+ bool shadowOnly = true;
9 int moveDx, moveDy;
10 int oldShiftX = 0;
11 int oldShiftY = 0;
12@@ -1409,28 +1410,31 @@
13 case CompWindowTypeMenuMask:
14 case CompWindowTypeNormalMask:
15 if (window->mwmDecor () & (MwmDecorAll | MwmDecorTitle))
16- decorate = (window->frame () ||
17- window->hasUnmapReference ()) ? true : false;
18+ shadowOnly = false;
19 default:
20 break;
21 }
22
23 if (window->overrideRedirect ())
24- decorate = false;
25+ shadowOnly = true;
26
27 if (window->wmType () & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
28- decorate = false;
29+ shadowOnly = true;
30
31- if (decorate)
32+ if (!shadowOnly)
33 {
34 if (!dScreen->optionGetDecorationMatch ().evaluate (window))
35- decorate = false;
36+ shadowOnly = true;
37 }
38 }
39 else
40- decorate = true;
41-
42- if (decorate)
43+ shadowOnly = false;
44+
45+ decorate = ((window->frame () ||
46+ window->hasUnmapReference ()) && !shadowOnly) ||
47+ isSwitcher;
48+
49+ if (decorate || frameExtentsRequested)
50 {
51 /* Attempt to find a matching decoration */
52 decoration = decor.findMatchingDecoration (window, true);
53@@ -1451,6 +1455,11 @@
54 else if (dScreen->dmSupports & WINDOW_DECORATION_TYPE_WINDOW)
55 decoration = &dScreen->windowDefault;
56 }
57+
58+ /* Do not allow windows which are later undecorated
59+ * to have a set _NET_FRAME_EXTENTS */
60+ if (decorate)
61+ frameExtentsRequested = false;
62 }
63 else
64 {
65@@ -1531,7 +1540,8 @@
66 moveDy = shiftY () - oldShiftY;
67
68 /* Update the input and output frame */
69- updateFrame ();
70+ if (decorate)
71+ updateFrame ();
72 window->updateWindowOutputExtents ();
73 if (dScreen->cmActive)
74 cWindow->damageOutputExtents ();
75@@ -1545,7 +1555,8 @@
76 /* Undecorated windows need to have the
77 * input and output frame removed and the
78 * frame window geometry reset */
79- updateFrame ();
80+ if (decorate)
81+ updateFrame ();
82
83 memset (&emptyExtents, 0, sizeof (CompWindowExtents));
84
85@@ -2056,6 +2067,8 @@
86 this->dmSupports = dmSupports;
87
88 /* Create new default decorations */
89+ screen->updateSupportedWmHints ();
90+
91 if (dmWin)
92 {
93 for (i = 0; i < DECOR_NUM; i++)
94@@ -2849,7 +2862,10 @@
95 {
96 screen->addSupportedAtoms (atoms);
97
98- atoms.push_back (requestFrameExtentsAtom);
99+ /* Don't support _NET_REQUEST_FRAME_EXTENTS
100+ * where there is no decorator running yet */
101+ if (dmWin)
102+ atoms.push_back (requestFrameExtentsAtom);
103 }
104
105 void
106@@ -3024,7 +3040,8 @@
107 updateReg (true),
108 unshading (false),
109 shading (false),
110- isSwitcher (false)
111+ isSwitcher (false),
112+ frameExtentsRequested (false)
113 {
114 WindowInterface::setHandler (window);
115
116
117=== modified file 'plugins/decor/src/decor.h'
118--- plugins/decor/src/decor.h 2011-10-15 11:00:51 +0000
119+++ plugins/decor/src/decor.h 2011-12-15 08:04:24 +0000
120@@ -274,6 +274,8 @@
121 bool unshading;
122 bool shading;
123 bool isSwitcher;
124+
125+ bool frameExtentsRequested;
126 };
127
128 class DecorPluginVTable :
129
130=== modified file 'po/POTFILES.in'
131--- po/POTFILES.in 2009-10-18 20:23:24 +0000
132+++ po/POTFILES.in 2011-12-15 08:04:24 +0000
133@@ -1,7 +1,4 @@
134-gtk/gnome/50-compiz-desktop-key.xml.in
135-gtk/gnome/50-compiz-key.xml.in
136 gtk/gnome/compiz.desktop.in
137-gtk/gnome/compiz-wm.desktop.in
138 gtk/window-decorator/gwd.schemas.in
139 gtk/window-decorator/gtk-window-decorator.c
140 metadata/core.xml.in
141
142=== modified file 'src/window.cpp'
143--- src/window.cpp 2011-11-07 02:27:18 +0000
144+++ src/window.cpp 2011-12-15 08:04:24 +0000
145@@ -6966,31 +6966,42 @@
146 priv->border.top != b->top ||
147 priv->border.bottom != b->bottom)
148 {
149- unsigned long data[4];
150-
151 priv->serverInput = *i;
152 priv->border = *b;
153
154 recalcActions ();
155
156- /* Use b for _NET_WM_FRAME_EXTENTS here because
157- * that is the representation of the actual decoration
158- * around the window that the user sees and should
159- * be used for placement and such */
160-
161- data[0] = b->left;
162- data[1] = b->right;
163- data[2] = b->top;
164- data[3] = b->bottom;
165-
166- XChangeProperty (screen->dpy (), priv->id,
167- Atoms::frameExtents,
168- XA_CARDINAL, 32, PropModeReplace,
169- (unsigned char *) data, 4);
170-
171 priv->updateSize ();
172 priv->updateFrameWindow ();
173 }
174+
175+ /* Use b for _NET_WM_FRAME_EXTENTS here because
176+ * that is the representation of the actual decoration
177+ * around the window that the user sees and should
178+ * be used for placement and such */
179+
180+ /* Also update frame extents regardless of whether or not
181+ * the frame extents actually changed, eg, a plugin could
182+ * suggest that a window has no frame extents and that it
183+ * might later get frame extents - this is mandatory if we
184+ * say that we support it, so set them
185+ * additionaly some applications might request frame extents
186+ * and we must respond by setting the property - ideally
187+ * this should only ever be done when some plugin actually
188+ * need to change the frame extents or the applications
189+ * requested it */
190+
191+ unsigned long data[4];
192+
193+ data[0] = b->left;
194+ data[1] = b->right;
195+ data[2] = b->top;
196+ data[3] = b->bottom;
197+
198+ XChangeProperty (screen->dpy (), priv->id,
199+ Atoms::frameExtents,
200+ XA_CARDINAL, 32, PropModeReplace,
201+ (unsigned char *) data, 4);
202 }
203
204 bool

Subscribers

People subscribed via source and target branches