Merge lp:~brandontschaefer/unity/lp.1100962-fix-hud-focus-problem-6.0 into lp:unity/6.0

Proposed by Brandon Schaefer
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 2800
Proposed branch: lp:~brandontschaefer/unity/lp.1100962-fix-hud-focus-problem-6.0
Merge into: lp:unity/6.0
Diff against target: 50 lines (+18/-2)
2 files modified
hud/HudController.cpp (+2/-0)
tests/autopilot/unity/tests/test_hud.py (+16/-2)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1100962-fix-hud-focus-problem-6.0
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Review via email: mp+143784@code.launchpad.net

Commit message

The Hud now saves the last_focused_window before opening the Hud.

Description of the change

=== Problem ===
When Alt+Tab was used, a last_focused_window was being saved. This is used when restoring a window if Alt+Tab does not focus a new window. The problem is the Hud does not save this window, so after an Alt+Tab, the last_focused_window was pointed to the window before the Alt+Tab. Then opening/closing the Hud would cause the Hud to attempt to restore the lat_focsued_window if it exited, since Alt+Tab was saving it, it would focus the window before the Alt+tab (incorrect).

=== Fix ===
We have the Hud save the last_focused_window as the window that focused before opening the Hud...

=== Test ===
There is an AP test for this.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Same bug, same awesomeness +1.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hud/HudController.cpp'
2--- hud/HudController.cpp 2012-09-18 17:39:36 +0000
3+++ hud/HudController.cpp 2013-01-17 21:58:22 +0000
4@@ -369,6 +369,8 @@
5 focused_app_icon_ = focused_app_icon_ = PKGDATADIR "/launcher_bfb.png";
6 }
7
8+ WindowManager::Default()->saveInputFocus();
9+
10 LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_;
11 SetIcon(focused_app_icon_);
12
13
14=== modified file 'tests/autopilot/unity/tests/test_hud.py'
15--- tests/autopilot/unity/tests/test_hud.py 2012-09-18 13:25:17 +0000
16+++ tests/autopilot/unity/tests/test_hud.py 2013-01-17 21:58:22 +0000
17@@ -417,10 +417,10 @@
18
19 (x,y,w,h) = self.hud.geometry
20 (screen_x,screen_y,screen_w,screen_h) = self.screen_geo.get_monitor_geometry(current_monitor)
21-
22+
23 self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2)
24 self.mouse.click()
25-
26+
27 self.assertThat(self.hud.visible, Eventually(Equals(False)))
28
29 def test_closes_then_focuses_window_on_mouse_down(self):
30@@ -442,6 +442,20 @@
31
32 self.assertProperty(char_win, is_active=True)
33
34+ def test_hud_does_not_focus_wrong_window_after_alt_tab(self):
35+ """Test the Hud focuses the correct window after an Alt+Tab."""
36+
37+ char_win = self.start_app('Character Map')
38+ self.start_app('Calculator')
39+
40+ self.keybinding("switcher/reveal_normal")
41+
42+ self.hud.ensure_visible()
43+ self.hud.ensure_hidden()
44+
45+ self.assertProperty(char_win, is_active=True)
46+
47+
48 class HudLauncherInteractionsTests(HudTestsBase):
49
50 launcher_modes = [('Launcher autohide', {'launcher_autohide': False}),

Subscribers

People subscribed via source and target branches