Merge lp:~compiz-team/compiz-core/compiz-core.fix_869316 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Approved by: David Barth
Approved revision: 2858
Merged at revision: 2860
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.fix_869316
Merge into: lp:compiz-core/0.9.5
Diff against target: 256 lines (+103/-43)
3 files modified
src/event.cpp (+76/-6)
src/stackdebugger.cpp (+5/-5)
src/window.cpp (+22/-32)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.fix_869316
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+78576@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

A word of warning for reviews (that's you Robert ;) : please be very cautious in verifying that the change will not introduce regressions.

In particular:
- crashers due to changing conditions where a call may fail where it could not before; or a property be invalid
- behavior changes introducing regressions elsewhere

For example, I see that there are changes to if/else condition statements. Some of that can be the object of the patch. But if the condition is more restrictive or more loose on the contrary: what will happen to objects and code that were run previously if they are not processed anymore? how will objects/code behave with the new conditions, where they were never called before.

Revision history for this message
Robert Carr (robertcarr) wrote :

+1

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-10-04 03:27:37 +0000
3+++ src/event.cpp 2011-10-07 12:03:26 +0000
4@@ -1842,13 +1842,24 @@
5
6 if (wa.root == priv->root)
7 {
8- if (event->xfocus.mode != NotifyGrab)
9+ if (event->xfocus.mode == NotifyGrab)
10+ priv->grabbed = true;
11+ else if (event->xfocus.mode == NotifyUngrab)
12+ priv->grabbed = false;
13+ else
14 {
15+ CompWindowList dockWindows;
16+ XWindowChanges xwc;
17+ unsigned int mask;
18+
19 w = findTopLevelWindow (event->xfocus.window);
20 if (w && w->managed ())
21 {
22 unsigned int state = w->state ();
23
24+ if (priv->nextActiveWindow == event->xfocus.window)
25+ priv->nextActiveWindow = None;
26+
27 if (w->id () != priv->activeWindow)
28 {
29 CompWindow *active = screen->findWindow (priv->activeWindow);
30@@ -1857,7 +1868,47 @@
31 w->priv->activeNum = priv->activeNum++;
32
33 if (active)
34+ {
35+ CompWindowList windowsLostFocus;
36+ /* If this window lost focus and was above a fullscreen window
37+ * and is no longer capable of being focused (eg, it is
38+ * not visible on this viewport) then we need to check if
39+ * any other windows below it are also now no longer capable
40+ * of being focused and restack them in the highest position
41+ * below docks that they are allowed to take */
42+ if (!active->focus ())
43+ {
44+ windowsLostFocus.push_back (active);
45+ for (CompWindow *fsw = active->prev; fsw; fsw = fsw->prev)
46+ {
47+ if (!fsw->focus () &&
48+ fsw->managed () &&
49+ !(fsw->type () & (CompWindowTypeDockMask |
50+ CompWindowTypeFullscreenMask)) &&
51+ !fsw->overrideRedirect ())
52+ windowsLostFocus.push_back (fsw);
53+
54+ if (fsw->type () & CompWindowTypeFullscreenMask)
55+ {
56+ /* This will be the window that we must lower relative to */
57+ CompWindow *sibling = PrivateWindow::findValidStackSiblingBelow (active, fsw);
58+
59+ if (sibling)
60+ {
61+ for (CompWindowList::reverse_iterator rit = windowsLostFocus.rbegin ();
62+ rit != windowsLostFocus.rend (); rit++)
63+ {
64+ (*rit)->restackAbove (sibling);
65+ }
66+ }
67+
68+ break;
69+ }
70+ }
71+ }
72+
73 active->priv->updatePassiveButtonGrabs ();
74+ }
75
76 w->priv->updatePassiveButtonGrabs ();
77
78@@ -1873,9 +1924,6 @@
79
80 state &= ~CompWindowStateDemandsAttentionMask;
81 w->changeState (state);
82-
83- if (priv->nextActiveWindow == event->xfocus.window)
84- priv->nextActiveWindow = None;
85 }
86 else if (event->xfocus.window == priv->root)
87 {
88@@ -1901,9 +1949,31 @@
89 }
90 }
91 }
92+
93+ /* Ensure that docks are stacked in the right place
94+ *
95+ * When a normal window gets the focus and is above a
96+ * fullscreen window, restack the docks to be above
97+ * the highest level mapped and visible normal window,
98+ * otherwise put them above the highest fullscreen window
99+ */
100+ if (w)
101+ {
102+ if (PrivateWindow::stackDocks (w, dockWindows, &xwc, &mask))
103+ {
104+ Window sibling = xwc.sibling;
105+ xwc.stack_mode = Above;
106+
107+ /* Then update the dock windows */
108+ foreach (CompWindow *dw, dockWindows)
109+ {
110+ xwc.sibling = sibling;
111+ dw->configureXWindow (mask, &xwc);
112+ }
113+ }
114+ }
115+
116 }
117- else
118- priv->grabbed = true;
119 }
120 else
121 {
122
123=== modified file 'src/stackdebugger.cpp'
124--- src/stackdebugger.cpp 2011-09-29 03:29:41 +0000
125+++ src/stackdebugger.cpp 2011-10-07 12:03:26 +0000
126@@ -344,7 +344,7 @@
127
128 /* search down the stack to check if there is a fullscreen
129 * window, otherwise we are not on the fullscreen layer */
130- for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)
131+ for (CompWindow *rw = w->prev; rw; rw = rw->prev)
132 {
133 if (rw->type () & CompWindowTypeFullscreenMask)
134 {
135@@ -384,9 +384,9 @@
136
137 /* search down the stack to check if there is a fullscreen
138 * window, otherwise we are not on the fullscreen layer */
139- for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)
140+ for (CompWindow *rw = w->prev; rw; rw = rw->prev)
141 {
142- if (rw->type () == CompWindowTypeFullscreenMask)
143+ if (rw->type () & CompWindowTypeFullscreenMask)
144 {
145 fullscreenWindow = true;
146 break;
147@@ -412,9 +412,9 @@
148
149 /* search down the stack to check if there is a fullscreen
150 * window, otherwise we are not on the fullscreen layer */
151- for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)
152+ for (CompWindow *rw = w->prev; rw; rw = rw->prev)
153 {
154- if (rw->type () == CompWindowTypeFullscreenMask)
155+ if (rw->type () & CompWindowTypeFullscreenMask)
156 {
157 fullscreenWindow = true;
158 break;
159
160=== modified file 'src/window.cpp'
161--- src/window.cpp 2011-10-03 12:58:36 +0000
162+++ src/window.cpp 2011-10-07 12:03:26 +0000
163@@ -2608,34 +2608,8 @@
164 }
165
166 if (setFocus)
167- {
168- CompWindowList dockWindows;
169- XWindowChanges xwc;
170- unsigned int mask;
171-
172 screen->priv->nextActiveWindow = priv->id;
173
174- /* Ensure that docks are stacked in the right place
175- *
176- * When a normal window gets the focus and is above a
177- * fullscreen window, restack the docks to be above
178- * the highest level mapped and visible normal window,
179- * otherwise put them above the highest fullscreen window
180- */
181- if (PrivateWindow::stackDocks (this, dockWindows, &xwc, &mask))
182- {
183- Window sibling = xwc.sibling;
184- xwc.stack_mode = Above;
185-
186- /* Then update the dock windows */
187- foreach (CompWindow *dw, dockWindows)
188- {
189- xwc.sibling = sibling;
190- dw->configureXWindow (mask, &xwc);
191- }
192- }
193- }
194-
195 if (!setFocus && !modalTransient)
196 {
197 CompWindow *ancestor;
198@@ -2836,6 +2810,10 @@
199 {
200 bool allowedRelativeToLayer = !(below->priv->type & belowMask);
201
202+ if (aboveFs && below->priv->type & CompWindowTypeFullscreenMask)
203+ if (!below->focus ())
204+ break;
205+
206 t = screen->findWindow (below->transientFor ());
207
208 while (t && allowedRelativeToLayer)
209@@ -3291,12 +3269,12 @@
210 {
211 /* If there is another toplevel window above the fullscreen one
212 * then we need to stack above that */
213- if (dw->focus () &&
214+ if ((dw->priv->managed && !dw->priv->unmanaging) &&
215+ !(dw->priv->state & CompWindowStateHiddenMask) &&
216 !PrivateWindow::isAncestorTo (w, dw) &&
217 !(dw->type () & (CompWindowTypeFullscreenMask |
218 CompWindowTypeDockMask)) &&
219- !dw->overrideRedirect () &&
220- dw->defaultViewport () == screen->vp () &&
221+ !dw->overrideRedirect () &&
222 dw->isViewable ())
223 {
224 belowDocks = dw;
225@@ -3310,10 +3288,11 @@
226 firstFullscreenWindow = dw;
227 for (CompWindow *dww = dw->serverPrev; dww; dww = dww->serverPrev)
228 {
229- if (!(dww->type () & (CompWindowTypeFullscreenMask |
230+ if ((dw->priv->managed && !dw->priv->unmanaging) &&
231+ !(dw->priv->state & CompWindowStateHiddenMask) &&
232+ !(dww->type () & (CompWindowTypeFullscreenMask |
233 CompWindowTypeDockMask)) &&
234- !dww->overrideRedirect () &&
235- dww->defaultViewport () == screen->vp () &&
236+ !dww->overrideRedirect () &&
237 dww->isViewable ())
238 {
239 belowDocks = dww;
240@@ -4099,6 +4078,17 @@
241 if (priv->id == screen->activeWindow ())
242 aboveFs = true;
243
244+ for (CompWindow *pw = serverPrev; pw; pw = pw->serverPrev)
245+ {
246+ if (pw->priv->type & CompWindowTypeFullscreenMask)
247+ {
248+ if (priv->id == screen->activeWindow ())
249+ aboveFs = true;
250+
251+ break;
252+ }
253+ }
254+
255 mask = priv->addWindowStackChanges (&xwc,
256 PrivateWindow::findSiblingBelow (this, aboveFs));
257

Subscribers

People subscribed via source and target branches