Merge lp:~brandontschaefer/unity/fix.885304 into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 2123
Proposed branch: lp:~brandontschaefer/unity/fix.885304
Merge into: lp:unity
Diff against target: 86 lines (+43/-2)
3 files modified
plugins/unityshell/src/LauncherController.cpp (+6/-2)
plugins/unityshell/src/unityshell.cpp (+5/-0)
tests/autopilot/autopilot/tests/test_launcher.py (+32/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/fix.885304
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+97781@code.launchpad.net

Commit message

* Fixes the problem where Alt+F1 wouldn't quit key nav mode. Now it toggles

Description of the change

= Problem description =

Alt is used to exit key nav mode (alt+f1), this means if you hit alt+f1 while in keynav mode it exits keynav mode, then starts it again. This is not the toggling effect wanted.

= The fix =

If alt + <anykey> is pressed then exit keynav mode.
Also if the hud is about to show exit keynav mode

= Test coverage =

There is an autopilot test for this

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

The code looks fine, we should get some autopilot tests around it :)

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Autopilot test looks awesome.

review: Approve
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

+1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/LauncherController.cpp'
2--- plugins/unityshell/src/LauncherController.cpp 2012-03-14 23:22:02 +0000
3+++ plugins/unityshell/src/LauncherController.cpp 2012-03-16 04:20:27 +0000
4@@ -1146,11 +1146,10 @@
5 parent_->KeyNavNext();
6 break;
7
8- // super/control/alt/esc/left (close quicklist or exit laucher key-focus)
9+ // super/control/esc/left (close quicklist or exit laucher key-focus)
10 case NUX_VK_LWIN:
11 case NUX_VK_RWIN:
12 case NUX_VK_CONTROL:
13- case NUX_VK_MENU:
14 case NUX_VK_LEFT:
15 case NUX_KP_LEFT:
16 case NUX_VK_ESCAPE:
17@@ -1187,6 +1186,11 @@
18 break;
19
20 default:
21+ // ALT + <Anykey>; treat it as a shortcut and exit keynav
22+ if (state & nux::NUX_STATE_ALT)
23+ {
24+ parent_->KeyNavTerminate(false);
25+ }
26 break;
27 }
28 }
29
30=== modified file 'plugins/unityshell/src/unityshell.cpp'
31--- plugins/unityshell/src/unityshell.cpp 2012-03-14 13:05:59 +0000
32+++ plugins/unityshell/src/unityshell.cpp 2012-03-16 04:20:27 +0000
33@@ -1947,6 +1947,11 @@
34 }
35 else
36 {
37+ // Handles closing KeyNav (Alt+F1) if the hud is about to show
38+ if (launcher_controller_->KeyNavIsActive())
39+ {
40+ launcher_controller_->KeyNavTerminate(false);
41+ }
42 hud_controller_->ShowHud();
43 }
44
45
46=== modified file 'tests/autopilot/autopilot/tests/test_launcher.py'
47--- tests/autopilot/autopilot/tests/test_launcher.py 2012-03-15 19:39:31 +0000
48+++ tests/autopilot/autopilot/tests/test_launcher.py 2012-03-16 04:20:27 +0000
49@@ -395,6 +395,38 @@
50 self.assertThat(self.launcher.key_nav_is_active, Equals(True))
51 self.assertThat(self.launcher.key_nav_is_grabbed, Equals(True))
52
53+ def test_launcher_keynav_mode_toggles(self):
54+ """Tests that keynav mode toggles with Alt+F1."""
55+ launcher_instance = self.get_launcher()
56+
57+ launcher_instance.key_nav_start()
58+ launcher_instance.key_nav_start()
59+
60+ self.assertThat(self.launcher.key_nav_is_active, Equals(False))
61+
62+ def test_launcher_keynav_alt_tab_quits(self):
63+ """Tests that alt+tab exits keynav mode."""
64+ launcher_instance = self.get_launcher()
65+ launcher_instance.key_nav_start()
66+
67+ self.switcher.initiate()
68+ sleep(1)
69+ self.switcher.stop()
70+
71+ self.assertThat(self.launcher.key_nav_is_active, Equals(False))
72+
73+ def test_launcher_keynav_alt_grave_quits(self):
74+ """Tests that alt+` exits keynav mode."""
75+ launcher_instance = self.get_launcher()
76+ launcher_instance.key_nav_start()
77+
78+ self.switcher.initiate_detail_mode()
79+ sleep(1)
80+ self.switcher.stop()
81+
82+ self.assertThat(self.launcher.key_nav_is_active, Equals(False))
83+
84+
85 class LauncherRevealTests(ScenariodLauncherTests):
86 """Test the launcher reveal bahavior when in autohide mode."""
87