Merge lp:~smspillaz/compiz-core/compiz-core.fix_888704 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 3076
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_888704
Merge into: lp:compiz-core
Diff against target: 115 lines (+42/-23)
3 files modified
CMakeLists.txt (+24/-0)
src/screen.cpp (+17/-1)
src/window.cpp (+1/-22)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_888704
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Alan Griffiths Needs Fixing
Review via email: mp+99470@code.launchpad.net

Description of the change

== Problem ==

See LP#888704 - a window that was raised but not focused with alt-tab would not have the focus returned to it once the preceeding window was closed

== Solution ==

Restore focus based on stacking order in the non click raise case.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Should not be a line continuation here:

CompWindow *nextActive = screen->findWindow (screen->priv->nextActiveWindow);\

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

No obvious problems in testing. And I can fix the aforementioned typo when I merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-02-02 17:10:07 +0000
3+++ CMakeLists.txt 2012-03-27 06:16:19 +0000
4@@ -121,6 +121,30 @@
5
6 # Build Google Test and make its headers known
7 find_package (GTest)
8+
9+if (NOT GTEST_FOUND)
10+
11+ # Check for google test and build it locally
12+ set (GTEST_ROOT_DIR
13+ "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake
14+ CACHE
15+ PATH
16+ "Path to Google test srcs"
17+ )
18+
19+ find_path (GTEST_INCLUDE_DIR gtest/gtest.h)
20+
21+ if (GTEST_INCLUDE_DIR)
22+ #FIXME - hardcoded is bad!
23+ add_subdirectory (${GTEST_ROOT_DIR}
24+ gtest)
25+ endif(GTEST_INCLUDE_DIR)
26+
27+ set (GTEST_BOTH_LIBRARIES gtest gtest_main)
28+ set (GTEST_FOUND TRUE)
29+
30+endif (NOT GTEST_FOUND)
31+
32 find_library (GMOCK_LIBRARY gmock)
33 find_library (GMOCK_MAIN_LIBRARY gmock_main)
34
35
36=== modified file 'src/screen.cpp'
37--- src/screen.cpp 2012-03-24 09:49:30 +0000
38+++ src/screen.cpp 2012-03-27 06:16:19 +0000
39@@ -2698,6 +2698,7 @@
40
41 if (!focus)
42 {
43+ /* Traverse down the stack */
44 for (CompWindowList::reverse_iterator rit = priv->windows.rbegin ();
45 rit != priv->windows.rend (); rit++)
46 {
47@@ -2714,12 +2715,27 @@
48 CompWindowTypeDialogMask |
49 CompWindowTypeModalDialogMask))
50 {
51- if (PrivateWindow::compareWindowActiveness (focus, w) < 0)
52+ if (!priv->optionGetClickToFocus ())
53+ {
54+ /* We should favor the more active window in the mouse focus
55+ * case since the user does not care if the focused window is on top */
56+ if (PrivateWindow::compareWindowActiveness (focus, w) < 0)
57+ focus = w;
58+ }
59+ else
60+ {
61 focus = w;
62+ break;
63+ }
64 }
65 }
66 else
67+ {
68 focus = w;
69+
70+ if (priv->optionGetClickToFocus ())
71+ break;
72+ }
73 }
74 }
75 }
76
77=== modified file 'src/window.cpp'
78--- src/window.cpp 2012-03-12 10:35:21 +0000
79+++ src/window.cpp 2012-03-27 06:16:19 +0000
80@@ -2864,8 +2864,7 @@
81 priv->id == screen->priv->nextActiveWindow)
82 {
83 CompWindow *ancestor;
84- CompWindow *nextActive = screen->findWindow (screen->priv->nextActiveWindow);
85- Window lastNextActiveWindow = screen->priv->nextActiveWindow;
86+ CompWindow *nextActive = screen->findWindow (screen->priv->nextActiveWindow);\
87
88 /* Window pending focus */
89 if (priv->id != screen->priv->nextActiveWindow &&
90@@ -2924,26 +2923,6 @@
91 }
92 else
93 screen->focusDefaultWindow ();
94-
95- /* FIXME:
96- * moveInputFocusTo and focusDefaultWindow should really
97- * return booleans */
98- if (lastNextActiveWindow != screen->priv->nextActiveWindow &&
99- screen->priv->optionGetRaiseOnClick ())
100- {
101- /* If this window just got the focus because another window
102- * was unmanaged then we should also raise it if click raise
103- * is on, since another plugin might have raised another window
104- * without wanting to focus it and this window will be beneath
105- * it in the stack but above it in the active window history
106- * so when the focus moves here this window should be raised
107- * That's the tradeoff for maintaining a predictable focus order
108- * as compared to eg a predictable stacking order */
109-
110- CompWindow *nextActive = screen->findWindow (screen->priv->nextActiveWindow);
111- if (nextActive)
112- nextActive->raise ();
113- }
114 }
115 }
116

Subscribers

People subscribed via source and target branches