Merge lp:~unity-team/compiz-core/compiz-core.fix_767095 into lp:compiz-core/trunk

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2741
Proposed branch: lp:~unity-team/compiz-core/compiz-core.fix_767095
Merge into: lp:compiz-core/trunk
Diff against target: 197 lines (+44/-55)
2 files modified
src/event.cpp (+6/-41)
src/window.cpp (+38/-14)
To merge this branch: bzr merge lp:~unity-team/compiz-core/compiz-core.fix_767095
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Sam Spilsbury Pending
Review via email: mp+62711@code.launchpad.net

Description of the change

Fixes the broken systray issue some people were getting

To post a comment you must log in.
2741. By Sam Spilsbury

Typo

2742. By Sam Spilsbury

Fix typo in comment

2743. By Sam Spilsbury

Fix windows appearing at small sizes

Revision history for this message
Jason Smith (jassmith) wrote :

can you explain why we dont need that big deleted section anymore?

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

Forcing and intercepting reparent is bad.

Also we don't need remove windows from createdWindows on ReparentNotify since createdWindows gets cleared every time a window gets created.

Revision history for this message
Jason Smith (jassmith) wrote :

+1 thanks for the explanation

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/event.cpp'
2--- src/event.cpp 2011-04-30 14:07:20 +0000
3+++ src/event.cpp 2011-05-30 12:14:31 +0000
4@@ -1204,7 +1204,7 @@
5 else if (!(event->xreparent.parent == priv->root))
6 {
7 bool remove = false;
8- Window xid = None;
9+ Window xid = event->xreparent.window;
10 Window root_return;
11 unsigned int ui;
12 int x, y;
13@@ -1218,47 +1218,12 @@
14 if (event->xreparent.parent != w->priv->wrapper)
15 {
16 w->moveInputFocusToOtherWindow ();
17-
18- /* In the case where someone else reparented one of
19- * our windows we are going to get the UnmapNotify first
20- * which means that this will start reparenting the
21- * window into the root window and interrupt
22- * the client's request to reparent into another
23- * window, we should handle this case */
24- if (!w->priv->frame)
25- {
26- xid = w->priv->id;
27- XGetGeometry (screen->dpy (), xid, &root_return,
28- &x, &y, &ui, &ui, &ui, &ui);
29- }
30 w->destroy ();
31- remove = true;
32- }
33- }
34- else
35- {
36- foreach (CoreWindow *cw, screen->priv->createdWindows)
37- {
38- if (cw->priv->id == event->xreparent.parent)
39- {
40- screen->priv->createdWindows.remove (cw);
41- delete cw;
42- remove = true;
43- break;
44- }
45- }
46- }
47-
48- if (remove)
49- {
50- XSelectInput (priv->dpy, w->id (), NoEventMask);
51- XShapeSelectInput (priv->dpy, w->id (), NoEventMask);
52- XUngrabButton (priv->dpy, AnyButton, AnyModifier, w->id ());
53-
54- /* Reparent the window back where it belongs */
55- if (xid)
56- XReparentWindow (screen->dpy (), xid, event->xreparent.parent,
57- x, y);
58+
59+ XSelectInput (priv->dpy, w->id (), NoEventMask);
60+ XShapeSelectInput (priv->dpy, w->id (), NoEventMask);
61+ XUngrabButton (priv->dpy, AnyButton, AnyModifier, w->id ());
62+ }
63 }
64 }
65 break;
66
67=== modified file 'src/window.cpp'
68--- src/window.cpp 2011-05-26 13:50:00 +0000
69+++ src/window.cpp 2011-05-30 12:14:31 +0000
70@@ -1424,9 +1424,9 @@
71 bool
72 CompWindow::resize (CompWindow::Geometry gm)
73 {
74- if (priv->attrib.width != gm.width () ||
75- priv->attrib.height != gm.height () ||
76- priv->attrib.border_width != gm.border ())
77+ if (priv->geometry.x () != gm.width () ||
78+ priv->geometry.y () != gm.height () ||
79+ priv->geometry.border () != gm.border ())
80 {
81 int pw, ph;
82 int dx, dy, dwidth, dheight;
83@@ -1463,7 +1463,7 @@
84 priv->invisible = WINDOW_INVISIBLE (priv);
85 priv->updateFrameWindow ();
86 }
87- else if (priv->attrib.x != gm.x () || priv->attrib.y != gm.y ())
88+ else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ())
89 {
90 int dx, dy;
91
92@@ -1603,10 +1603,8 @@
93 priv->attrib.override_redirect = ce->override_redirect;
94
95 if (priv->syncWait)
96- {
97 priv->syncGeometry.set (ce->x, ce->y, ce->width, ce->height,
98 ce->border_width);
99- }
100 else
101 {
102 if (ce->override_redirect)
103@@ -5718,7 +5716,6 @@
104 PrivateWindow::reparent ()
105 {
106 XSetWindowAttributes attr;
107- XWindowAttributes wa;
108 XWindowChanges xwc;
109 int mask;
110 unsigned int nchildren;
111@@ -5730,19 +5727,30 @@
112 Colormap cmap = DefaultColormap (screen->dpy (),
113 screen->screenNum ());
114
115- if (frame || attrib.override_redirect)
116+ if (frame)
117 return false;
118
119 XSync (dpy, false);
120 XGrabServer (dpy);
121
122- if (!XGetWindowAttributes (dpy, id, &wa))
123+ if (!XGetWindowAttributes (dpy, id, &attrib))
124 {
125 XUngrabServer (dpy);
126 XSync (dpy, false);
127 return false;
128 }
129
130+ /* Since we have read directly to our XWindowAttributes
131+ * we need to update the size of a window since it might
132+ * have changed during the reparent
133+ */
134+
135+ window->resize (attrib.x, attrib.y, attrib.width, attrib.height,
136+ attrib.border_width);
137+
138+ if (attrib.override_redirect)
139+ return false;
140+
141 /* Don't ever reparent windows which have ended up
142 * reparented themselves on the server side but not
143 * on the client side */
144@@ -5823,7 +5831,7 @@
145
146 XChangeWindowAttributes (dpy, id, CWEventMask | CWDontPropagate, &attr);
147
148- if (wa.map_state == IsViewable || shaded)
149+ if (attrib.map_state == IsViewable || shaded)
150 XMapWindow (dpy, frame);
151
152 attr.event_mask = SubstructureRedirectMask | StructureNotifyMask |
153@@ -5861,10 +5869,12 @@
154 void
155 PrivateWindow::unreparent ()
156 {
157- Display *dpy = screen->dpy ();
158- XEvent e;
159- bool alive = true;
160- XWindowChanges xwc;
161+ Display *dpy = screen->dpy ();
162+ XEvent e;
163+ bool alive = true;
164+ XWindowChanges xwc;
165+ unsigned int nchildren;
166+ Window *children = NULL, root_return, parent_return;
167
168 if (!frame)
169 return;
170@@ -5877,6 +5887,17 @@
171 alive = false;
172 }
173
174+ /* Also don't reparent back into root windows that have ended up
175+ * reparented into other windows (and as such we are unmanaging them) */
176+
177+ if (alive)
178+ {
179+ XQueryTree (dpy, id, &root_return, &parent_return, &children, &nchildren);
180+
181+ if (parent_return != wrapper)
182+ alive = false;
183+ }
184+
185 if ((!destroyed) && alive)
186 {
187 XGrabServer (dpy);
188@@ -5922,6 +5943,9 @@
189 XMoveWindow (dpy, id, serverGeometry.x (), serverGeometry.y ());
190 }
191
192+ if (children)
193+ XFree (children);
194+
195 XDestroyWindow (dpy, wrapper);
196 XDestroyWindow (dpy, frame);
197 wrapper = None;

Subscribers

People subscribed via source and target branches

to all changes: