Ubuntu

Merge lp:~om26er/ubuntu/oneiric/unity/unity-fix-840285 into lp:~ubuntu-desktop/unity/ubuntu

Proposed by Omer Akram on 2011-09-09
Status: Rejected
Rejected by: Didier Roche on 2011-09-12
Proposed branch: lp:~om26er/ubuntu/oneiric/unity/unity-fix-840285
Merge into: lp:~ubuntu-desktop/unity/ubuntu
Diff against target: 291 lines (+148/-33) 5 files modified
To merge this branch: bzr merge lp:~om26er/ubuntu/oneiric/unity/unity-fix-840285
Reviewer Review Type Date Requested Status
Didier Roche 2011-09-09 Disapprove on 2011-09-12
Ubuntu Sponsors Team 2011-09-09 Pending
Review via email: mp+74854@code.launchpad.net

Description of the Change

Backport a fix from trunk where the titlebar of a window becomes "click through" after its raised from minimize.

This branch was backported: https://code.launchpad.net/~smspillaz/unity/unity.stack_debug_fixed_minimized_windows

To post a comment you must log in.
Didier Roche (didrocks) wrote :

Hey Omer,

Too bad, didn't see that merge proposal as first thing I did today was to push a compiz ABI break with an unity rebuild.
Normally, I don't backcport changes from trunk apart from late beta (it's too much of work for few days and we are not in a SRU process. If we start doing that, we will only do that and nothing else…). However, I backported this one on my own seeing the number of people complaining on the french forum :)

So I backported this one. Please, on things you think that should be backported in trunk, ping me on IRC first, that will be way easier. Have to disapprove as a similar backport is already committed, sorry :/

review: Disapprove
Omer Akram (om26er) wrote :

no worries, I'll ping you on IRC the next time if anything needed ;-)

Unmerged revisions

565. By Omer Akram on 2011-09-09

Titlebar is click through after raising a minimized window. (LP: #840285)

Preview Diff

1=== modified file 'debian/changelog'
2--- debian/changelog 2011-09-08 18:07:52 +0000
3+++ debian/changelog 2011-09-09 18:34:27 +0000
4@@ -1,3 +1,9 @@
5+unity (4.14.2-0ubuntu2) oneiric; urgency=low
6+
7+ * Titlebar is click through after raising a minimized window. (LP: #840285)
8+
9+ -- Omer Akram <om26er@ubuntu.com> Fri, 09 Sep 2011 23:18:27 +0500
10+
11 unity (4.14.2-0ubuntu1) oneiric; urgency=low
12
13 * New upstream release.
14
15=== modified file 'plugins/unityshell/src/compizminimizedwindowhandler.h'
16--- plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-02 14:32:40 +0000
17+++ plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-09 18:34:27 +0000
18@@ -37,7 +37,6 @@
19 PrivateCompizMinimizedWindowHandler () {};
20
21 CompWindow *mWindow;
22- WindowInputRemover *clientInputRemover;
23 };
24
25 template <typename Screen, typename Window>
26@@ -87,7 +86,6 @@
27 priv = new PrivateCompizMinimizedWindowHandler ();
28
29 priv->mWindow = w;
30- priv->clientInputRemover = NULL;
31
32 }
33
34@@ -115,33 +113,7 @@
35 void
36 compiz::CompizMinimizedWindowHandler<Screen, Window>::setVisibility (bool visible)
37 {
38- CompWindow::Geometry gm = priv->mWindow->geometry ();
39- MinimizedWindowHandler::setVisibility (visible, ROOTPARENT (priv->mWindow));
40-
41- if (!visible && !priv->clientInputRemover)
42- {
43- priv->clientInputRemover = new compiz::WindowInputRemover (screen->dpy (), priv->mWindow->id ());
44- if (!priv->clientInputRemover)
45- return;
46-
47- if (priv->clientInputRemover->save ())
48- priv->clientInputRemover->remove ();
49- }
50- else if (visible && priv->clientInputRemover)
51- {
52- priv->clientInputRemover->restore ();
53-
54- delete priv->clientInputRemover;
55- priv->clientInputRemover = NULL;
56- }
57-
58- /* This is a little hack to ensure that the window region gets updated,
59- * because there's no API in core to do that */
60-
61- gm.setBorder (gm.border () + 1);
62- priv->mWindow->resize (gm);
63- gm.setBorder (gm.border () - 1);
64- priv->mWindow->resize (gm);
65+ MinimizedWindowHandler::setVisibility (visible, priv->mWindow->id ());
66
67 CompositeWindow::get (priv->mWindow)->addDamage ();
68 GLWindow::get (priv->mWindow)->glPaintSetEnabled (Window::get (priv->mWindow), !visible);
69@@ -285,8 +257,10 @@
70 void
71 compiz::CompizMinimizedWindowHandler<Screen, Window>::handleEvent (XEvent *event)
72 {
73+ /* Ignore sent events from the InputRemover */
74 if (screen->XShape () && event->type ==
75- screen->shapeEvent () + ShapeNotify)
76+ screen->shapeEvent () + ShapeNotify &&
77+ !event->xany.send_event)
78 {
79 CompWindow *w = screen->findWindow (((XShapeEvent *) event)->window);
80
81
82=== modified file 'plugins/unityshell/src/inputremover.cpp'
83--- plugins/unityshell/src/inputremover.cpp 2011-09-02 14:32:40 +0000
84+++ plugins/unityshell/src/inputremover.cpp 2011-09-09 18:34:27 +0000
85@@ -20,6 +20,7 @@
86 */
87
88 #include "inputremover.h"
89+#include <X11/Xregion.h>
90 #include <cstdio>
91
92 compiz::WindowInputRemover::WindowInputRemover (Display *dpy,
93@@ -43,6 +44,132 @@
94 restore ();
95 }
96
97+void
98+compiz::WindowInputRemover::sendShapeNotify ()
99+{
100+ /* Send a synthetic ShapeNotify event to the root window
101+ * since we ignored shape events when setting visibility
102+ * in order to avoid cycling in the shape handling code -
103+ * ignore the sent shape notify event since that will
104+ * be send_event = true */
105+
106+ XShapeEvent xsev;
107+ XEvent *xev = (XEvent *) &xsev;
108+ Window rootReturn, parentReturn;
109+ Window childReturn;
110+ Window *children;
111+ int x, y, xOffset, yOffset;
112+ unsigned int width, height, depth, border, nchildren;
113+ int shapeEvent, shapeError, shapeMask;
114+
115+ /* FIXME: roundtrip */
116+ XShapeQueryExtension (mDpy, &shapeEvent, &shapeError);
117+ shapeMask = XShapeInputSelected (mDpy, mShapeWindow);
118+
119+ xev->type = shapeEvent + ShapeNotify;
120+ xsev.window = mShapeWindow;
121+
122+ if (!mRemoved)
123+ {
124+ /* FIXME: these roundtrips suck */
125+ XGetGeometry (mDpy, mShapeWindow, &rootReturn, &x, &y, &width, &height, &depth, &border);
126+ XQueryTree (mDpy, mShapeWindow, &rootReturn, &parentReturn, &children, &nchildren);
127+
128+ /* We need to translate the co-ordinates of the origin to the
129+ * client window to its parent to find out the offset of its
130+ * position so that we can subtract that from the final bounding
131+ * rect of the window shape according to the Shape extension
132+ * specification */
133+
134+ XTranslateCoordinates (mDpy, mShapeWindow, parentReturn, 0, 0, &xOffset, &yOffset, &childReturn);
135+
136+ xev->type = ShapeBounding;
137+
138+ /* Calculate extents of the bounding shape */
139+ if (!mNBoundingRects)
140+ {
141+ /* No set input shape, we must use the client geometry */
142+ xsev.x = x - xOffset;
143+ xsev.y = y - yOffset;
144+ xsev.width = width;
145+ xsev.height = height;
146+ xsev.shaped = false;
147+ }
148+ else
149+ {
150+ Region boundingRegion = XCreateRegion ();
151+
152+ for (int i = 0; i < mNBoundingRects; i++)
153+ XUnionRectWithRegion (&(mBoundingRects[i]), boundingRegion, boundingRegion);
154+
155+ xsev.x = boundingRegion->extents.x1 - xOffset;
156+ xsev.y = boundingRegion->extents.y1 - yOffset;
157+ xsev.width = boundingRegion->extents.x2 - boundingRegion->extents.x1;
158+ xsev.height = boundingRegion->extents.y2 - boundingRegion->extents.y1;
159+ xsev.shaped = true;
160+
161+ XDestroyRegion (boundingRegion);
162+ }
163+
164+ xsev.time = CurrentTime;
165+ XSendEvent (mDpy, DefaultRootWindow (mDpy), false, shapeMask, xev);
166+
167+ xev->type = ShapeInput;
168+
169+ /* Calculate extents of the bounding shape */
170+ if (!mNInputRects)
171+ {
172+ /* No set input shape, we must use the client geometry */
173+ xsev.x = x - xOffset;
174+ xsev.y = y - yOffset;
175+ xsev.width = width;
176+ xsev.height = height;
177+ xsev.shaped = false;
178+ }
179+ else
180+ {
181+ Region inputRegion = XCreateRegion ();
182+
183+ for (int i = 0; i < mNInputRects; i++)
184+ XUnionRectWithRegion (&(mInputRects[i]), inputRegion, inputRegion);
185+
186+ xsev.x = inputRegion->extents.x1 - xOffset;
187+ xsev.y = inputRegion->extents.y1 - yOffset;
188+ xsev.width = inputRegion->extents.x2 - inputRegion->extents.x1;
189+ xsev.height = inputRegion->extents.y2 - inputRegion->extents.y1;
190+ xsev.shaped = true;
191+
192+ XDestroyRegion (inputRegion);
193+ }
194+
195+ xsev.time = CurrentTime;
196+ XSendEvent (mDpy, DefaultRootWindow (mDpy), false, shapeMask, xev);
197+
198+ if (children)
199+ XFree (children);
200+ }
201+ else
202+ {
203+ xev->type = ShapeBounding;
204+
205+ xsev.x = 0;
206+ xsev.y = 0;
207+ xsev.width = 0;
208+ xsev.height = 0;
209+ xsev.shaped = true;
210+
211+ xsev.time = CurrentTime;
212+ XSendEvent (mDpy, DefaultRootWindow (mDpy), false, shapeMask, xev);
213+
214+ xev->type = ShapeInput;
215+
216+ /* Both ShapeBounding and ShapeInput are null */
217+
218+ xsev.time = CurrentTime;
219+ XSendEvent (mDpy, DefaultRootWindow (mDpy), false, shapeMask, xev);
220+ }
221+}
222+
223 bool
224 compiz::WindowInputRemover::save ()
225 {
226@@ -111,6 +238,8 @@
227
228 XShapeSelectInput (mDpy, mShapeWindow, ShapeNotify);
229
230+ sendShapeNotify ();
231+
232 mRemoved = true;
233 return true;
234 }
235@@ -125,6 +254,7 @@
236 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeInput, 0, 0,
237 mInputRects, mNInputRects,
238 ShapeSet, mInputRectOrdering);
239+
240 }
241 else
242 {
243@@ -153,6 +283,8 @@
244
245 XShapeSelectInput (mDpy, mShapeWindow, mShapeMask);
246
247+ sendShapeNotify ();
248+
249 mRemoved = false;
250 mNInputRects = 0;
251 mInputRects = NULL;
252
253=== modified file 'plugins/unityshell/src/inputremover.h'
254--- plugins/unityshell/src/inputremover.h 2011-09-01 17:18:02 +0000
255+++ plugins/unityshell/src/inputremover.h 2011-09-09 18:34:27 +0000
256@@ -41,6 +41,9 @@
257 bool restore ();
258
259 private:
260+
261+ void sendShapeNotify ();
262+
263 Display *mDpy;
264 Window mShapeWindow;
265 unsigned long mShapeMask;
266@@ -52,7 +55,7 @@
267 XRectangle *mBoundingRects;
268 int mNBoundingRects;
269 int mBoundingRectOrdering;
270- bool mRemoved;
271+ bool mRemoved;
272
273 };
274 }
275
276=== modified file 'plugins/unityshell/src/minimizedwindowhandler.cpp'
277--- plugins/unityshell/src/minimizedwindowhandler.cpp 2011-08-26 10:37:35 +0000
278+++ plugins/unityshell/src/minimizedwindowhandler.cpp 2011-09-09 18:34:27 +0000
279@@ -58,10 +58,10 @@
280 {
281 priv->mRemover = new compiz::WindowInputRemover (priv->mDpy, shapeWin);
282 if (!priv->mRemover)
283- return;
284+ return;
285
286 if (priv->mRemover->save ())
287- priv->mRemover->remove ();
288+ priv->mRemover->remove ();
289 }
290 else if (visible && priv->mRemover)
291 {

Subscribers

People subscribed via source and target branches

to all changes: