Merge lp:~brandontschaefer/unity/alt+tab-focus-fix-6.0 into lp:unity/6.0

Proposed by Brandon Schaefer
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 2741
Proposed branch: lp:~brandontschaefer/unity/alt+tab-focus-fix-6.0
Merge into: lp:unity/6.0
Diff against target: 36 lines (+17/-1)
2 files modified
manual-tests/Switcher.txt (+15/-0)
plugins/unityshell/src/unityshell.cpp (+2/-1)
To merge this branch: bzr merge lp:~brandontschaefer/unity/alt+tab-focus-fix-6.0
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+126287@code.launchpad.net

Commit message

Fixes alt+tab losing focus when alt+tabing to quickly due to ubus being to slow to send a message.

Description of the change

When alt+tabing quick enough and sometimes it would lose focus. This was caused by ubus sometimes sending the UBUS_SWITCHER_START message after the switcher has shown...which focuses the switcher window...but since the switcher window was closed it stole the focus. Now it checks if the switcher is visible BEFORE focusing the input to the window.

There would be no reasonable/consistent way to test this...as it was a very hard problem to reproduce to begin with.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Good for me, waiting for the manual test before globally approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Switcher.txt'
2--- manual-tests/Switcher.txt 2012-08-21 22:09:19 +0000
3+++ manual-tests/Switcher.txt 2012-09-26 18:08:19 +0000
4@@ -103,3 +103,18 @@
5
6 Expected Result:
7 The assertions from above hold.
8+
9+Alt+Tab doesn't lose window focus
10+---------------------------------
11+This tests ensures that a racing condition is not possible anymore when alt+tabing.
12+
13+Setup:
14+#. Have 2 windows of different types open. (gedit, nautilus)
15+
16+Actions:
17+ #. Press quicky Alt+Tab. (so that the switcher window is not shown)
18+ #. Repeat 10 times.
19+
20+Expected Results:
21+ No window loses focuses at all. The panel should alway show the title of the
22+ window.
23
24=== modified file 'plugins/unityshell/src/unityshell.cpp'
25--- plugins/unityshell/src/unityshell.cpp 2012-09-24 19:39:00 +0000
26+++ plugins/unityshell/src/unityshell.cpp 2012-09-26 18:08:19 +0000
27@@ -2086,7 +2086,8 @@
28
29 void UnityScreen::OnSwitcherStart(GVariant* data)
30 {
31- SaveInputThenFocus(switcher_controller_->GetSwitcherInputWindowId());
32+ if (switcher_controller_->Visible())
33+ SaveInputThenFocus(switcher_controller_->GetSwitcherInputWindowId());
34 }
35
36 void UnityScreen::OnSwitcherEnd(GVariant* data)

Subscribers

People subscribed via source and target branches