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
=== modified file 'src/event.cpp'
--- src/event.cpp 2011-10-04 03:27:37 +0000
+++ src/event.cpp 2011-10-07 12:03:26 +0000
@@ -1842,13 +1842,24 @@
18421842
1843 if (wa.root == priv->root)1843 if (wa.root == priv->root)
1844 {1844 {
1845 if (event->xfocus.mode != NotifyGrab)1845 if (event->xfocus.mode == NotifyGrab)
1846 priv->grabbed = true;
1847 else if (event->xfocus.mode == NotifyUngrab)
1848 priv->grabbed = false;
1849 else
1846 {1850 {
1851 CompWindowList dockWindows;
1852 XWindowChanges xwc;
1853 unsigned int mask;
1854
1847 w = findTopLevelWindow (event->xfocus.window);1855 w = findTopLevelWindow (event->xfocus.window);
1848 if (w && w->managed ())1856 if (w && w->managed ())
1849 {1857 {
1850 unsigned int state = w->state ();1858 unsigned int state = w->state ();
18511859
1860 if (priv->nextActiveWindow == event->xfocus.window)
1861 priv->nextActiveWindow = None;
1862
1852 if (w->id () != priv->activeWindow)1863 if (w->id () != priv->activeWindow)
1853 {1864 {
1854 CompWindow *active = screen->findWindow (priv->activeWindow);1865 CompWindow *active = screen->findWindow (priv->activeWindow);
@@ -1857,7 +1868,47 @@
1857 w->priv->activeNum = priv->activeNum++;1868 w->priv->activeNum = priv->activeNum++;
18581869
1859 if (active)1870 if (active)
1871 {
1872 CompWindowList windowsLostFocus;
1873 /* If this window lost focus and was above a fullscreen window
1874 * and is no longer capable of being focused (eg, it is
1875 * not visible on this viewport) then we need to check if
1876 * any other windows below it are also now no longer capable
1877 * of being focused and restack them in the highest position
1878 * below docks that they are allowed to take */
1879 if (!active->focus ())
1880 {
1881 windowsLostFocus.push_back (active);
1882 for (CompWindow *fsw = active->prev; fsw; fsw = fsw->prev)
1883 {
1884 if (!fsw->focus () &&
1885 fsw->managed () &&
1886 !(fsw->type () & (CompWindowTypeDockMask |
1887 CompWindowTypeFullscreenMask)) &&
1888 !fsw->overrideRedirect ())
1889 windowsLostFocus.push_back (fsw);
1890
1891 if (fsw->type () & CompWindowTypeFullscreenMask)
1892 {
1893 /* This will be the window that we must lower relative to */
1894 CompWindow *sibling = PrivateWindow::findValidStackSiblingBelow (active, fsw);
1895
1896 if (sibling)
1897 {
1898 for (CompWindowList::reverse_iterator rit = windowsLostFocus.rbegin ();
1899 rit != windowsLostFocus.rend (); rit++)
1900 {
1901 (*rit)->restackAbove (sibling);
1902 }
1903 }
1904
1905 break;
1906 }
1907 }
1908 }
1909
1860 active->priv->updatePassiveButtonGrabs ();1910 active->priv->updatePassiveButtonGrabs ();
1911 }
18611912
1862 w->priv->updatePassiveButtonGrabs ();1913 w->priv->updatePassiveButtonGrabs ();
18631914
@@ -1873,9 +1924,6 @@
18731924
1874 state &= ~CompWindowStateDemandsAttentionMask;1925 state &= ~CompWindowStateDemandsAttentionMask;
1875 w->changeState (state);1926 w->changeState (state);
1876
1877 if (priv->nextActiveWindow == event->xfocus.window)
1878 priv->nextActiveWindow = None;
1879 }1927 }
1880 else if (event->xfocus.window == priv->root)1928 else if (event->xfocus.window == priv->root)
1881 {1929 {
@@ -1901,9 +1949,31 @@
1901 }1949 }
1902 }1950 }
1903 }1951 }
1952
1953 /* Ensure that docks are stacked in the right place
1954 *
1955 * When a normal window gets the focus and is above a
1956 * fullscreen window, restack the docks to be above
1957 * the highest level mapped and visible normal window,
1958 * otherwise put them above the highest fullscreen window
1959 */
1960 if (w)
1961 {
1962 if (PrivateWindow::stackDocks (w, dockWindows, &xwc, &mask))
1963 {
1964 Window sibling = xwc.sibling;
1965 xwc.stack_mode = Above;
1966
1967 /* Then update the dock windows */
1968 foreach (CompWindow *dw, dockWindows)
1969 {
1970 xwc.sibling = sibling;
1971 dw->configureXWindow (mask, &xwc);
1972 }
1973 }
1974 }
1975
1904 }1976 }
1905 else
1906 priv->grabbed = true;
1907 }1977 }
1908 else1978 else
1909 {1979 {
19101980
=== modified file 'src/stackdebugger.cpp'
--- src/stackdebugger.cpp 2011-09-29 03:29:41 +0000
+++ src/stackdebugger.cpp 2011-10-07 12:03:26 +0000
@@ -344,7 +344,7 @@
344344
345 /* search down the stack to check if there is a fullscreen345 /* search down the stack to check if there is a fullscreen
346 * window, otherwise we are not on the fullscreen layer */346 * window, otherwise we are not on the fullscreen layer */
347 for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)347 for (CompWindow *rw = w->prev; rw; rw = rw->prev)
348 {348 {
349 if (rw->type () & CompWindowTypeFullscreenMask)349 if (rw->type () & CompWindowTypeFullscreenMask)
350 {350 {
@@ -384,9 +384,9 @@
384384
385 /* search down the stack to check if there is a fullscreen385 /* search down the stack to check if there is a fullscreen
386 * window, otherwise we are not on the fullscreen layer */386 * window, otherwise we are not on the fullscreen layer */
387 for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)387 for (CompWindow *rw = w->prev; rw; rw = rw->prev)
388 {388 {
389 if (rw->type () == CompWindowTypeFullscreenMask)389 if (rw->type () & CompWindowTypeFullscreenMask)
390 {390 {
391 fullscreenWindow = true;391 fullscreenWindow = true;
392 break;392 break;
@@ -412,9 +412,9 @@
412412
413 /* search down the stack to check if there is a fullscreen413 /* search down the stack to check if there is a fullscreen
414 * window, otherwise we are not on the fullscreen layer */414 * window, otherwise we are not on the fullscreen layer */
415 for (CompWindow *rw = w->serverPrev; rw; rw = rw->serverPrev)415 for (CompWindow *rw = w->prev; rw; rw = rw->prev)
416 {416 {
417 if (rw->type () == CompWindowTypeFullscreenMask)417 if (rw->type () & CompWindowTypeFullscreenMask)
418 {418 {
419 fullscreenWindow = true;419 fullscreenWindow = true;
420 break;420 break;
421421
=== modified file 'src/window.cpp'
--- src/window.cpp 2011-10-03 12:58:36 +0000
+++ src/window.cpp 2011-10-07 12:03:26 +0000
@@ -2608,34 +2608,8 @@
2608 }2608 }
26092609
2610 if (setFocus)2610 if (setFocus)
2611 {
2612 CompWindowList dockWindows;
2613 XWindowChanges xwc;
2614 unsigned int mask;
2615
2616 screen->priv->nextActiveWindow = priv->id;2611 screen->priv->nextActiveWindow = priv->id;
26172612
2618 /* Ensure that docks are stacked in the right place
2619 *
2620 * When a normal window gets the focus and is above a
2621 * fullscreen window, restack the docks to be above
2622 * the highest level mapped and visible normal window,
2623 * otherwise put them above the highest fullscreen window
2624 */
2625 if (PrivateWindow::stackDocks (this, dockWindows, &xwc, &mask))
2626 {
2627 Window sibling = xwc.sibling;
2628 xwc.stack_mode = Above;
2629
2630 /* Then update the dock windows */
2631 foreach (CompWindow *dw, dockWindows)
2632 {
2633 xwc.sibling = sibling;
2634 dw->configureXWindow (mask, &xwc);
2635 }
2636 }
2637 }
2638
2639 if (!setFocus && !modalTransient)2613 if (!setFocus && !modalTransient)
2640 {2614 {
2641 CompWindow *ancestor;2615 CompWindow *ancestor;
@@ -2836,6 +2810,10 @@
2836 {2810 {
2837 bool allowedRelativeToLayer = !(below->priv->type & belowMask);2811 bool allowedRelativeToLayer = !(below->priv->type & belowMask);
28382812
2813 if (aboveFs && below->priv->type & CompWindowTypeFullscreenMask)
2814 if (!below->focus ())
2815 break;
2816
2839 t = screen->findWindow (below->transientFor ());2817 t = screen->findWindow (below->transientFor ());
28402818
2841 while (t && allowedRelativeToLayer)2819 while (t && allowedRelativeToLayer)
@@ -3291,12 +3269,12 @@
3291 {3269 {
3292 /* If there is another toplevel window above the fullscreen one3270 /* If there is another toplevel window above the fullscreen one
3293 * then we need to stack above that */3271 * then we need to stack above that */
3294 if (dw->focus () &&3272 if ((dw->priv->managed && !dw->priv->unmanaging) &&
3273 !(dw->priv->state & CompWindowStateHiddenMask) &&
3295 !PrivateWindow::isAncestorTo (w, dw) &&3274 !PrivateWindow::isAncestorTo (w, dw) &&
3296 !(dw->type () & (CompWindowTypeFullscreenMask |3275 !(dw->type () & (CompWindowTypeFullscreenMask |
3297 CompWindowTypeDockMask)) &&3276 CompWindowTypeDockMask)) &&
3298 !dw->overrideRedirect () &&3277 !dw->overrideRedirect () &&
3299 dw->defaultViewport () == screen->vp () &&
3300 dw->isViewable ())3278 dw->isViewable ())
3301 {3279 {
3302 belowDocks = dw;3280 belowDocks = dw;
@@ -3310,10 +3288,11 @@
3310 firstFullscreenWindow = dw;3288 firstFullscreenWindow = dw;
3311 for (CompWindow *dww = dw->serverPrev; dww; dww = dww->serverPrev)3289 for (CompWindow *dww = dw->serverPrev; dww; dww = dww->serverPrev)
3312 {3290 {
3313 if (!(dww->type () & (CompWindowTypeFullscreenMask |3291 if ((dw->priv->managed && !dw->priv->unmanaging) &&
3292 !(dw->priv->state & CompWindowStateHiddenMask) &&
3293 !(dww->type () & (CompWindowTypeFullscreenMask |
3314 CompWindowTypeDockMask)) &&3294 CompWindowTypeDockMask)) &&
3315 !dww->overrideRedirect () &&3295 !dww->overrideRedirect () &&
3316 dww->defaultViewport () == screen->vp () &&
3317 dww->isViewable ())3296 dww->isViewable ())
3318 {3297 {
3319 belowDocks = dww;3298 belowDocks = dww;
@@ -4099,6 +4078,17 @@
4099 if (priv->id == screen->activeWindow ())4078 if (priv->id == screen->activeWindow ())
4100 aboveFs = true;4079 aboveFs = true;
41014080
4081 for (CompWindow *pw = serverPrev; pw; pw = pw->serverPrev)
4082 {
4083 if (pw->priv->type & CompWindowTypeFullscreenMask)
4084 {
4085 if (priv->id == screen->activeWindow ())
4086 aboveFs = true;
4087
4088 break;
4089 }
4090 }
4091
4102 mask = priv->addWindowStackChanges (&xwc,4092 mask = priv->addWindowStackChanges (&xwc,
4103 PrivateWindow::findSiblingBelow (this, aboveFs));4093 PrivateWindow::findSiblingBelow (this, aboveFs));
41044094

Subscribers

People subscribed via source and target branches