Merge lp:~brandontschaefer/unity/new.fix-896122 into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Jason Smith
Approved revision: no longer in the source branch.
Merged at revision: 1897
Proposed branch: lp:~brandontschaefer/unity/new.fix-896122
Merge into: lp:unity
Diff against target: 149 lines (+74/-1)
2 files modified
manual-tests/Launcher.txt (+43/-0)
plugins/unityshell/src/LauncherController.cpp (+31/-1)
To merge this branch: bzr merge lp:~brandontschaefer/unity/new.fix-896122
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+90981@code.launchpad.net

Description of the change

Clicking now quits the KeyNav mode from the launcher and if the quicklist is open. Shortcuts while in KeyNav mode now work and quit KeyNav mode.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Done well, simply, and effective. Good work

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Launcher.txt'
2--- manual-tests/Launcher.txt 2012-01-31 09:59:01 +0000
3+++ manual-tests/Launcher.txt 2012-02-02 03:21:18 +0000
4@@ -41,3 +41,46 @@
5 When moving to a workspace where there are no window o the given application,
6 clicking on its launcher icon should bring to focus the last focused window
7 in the last used workspace.
8+
9+Test Alt+F1 KeyNavMode Mouse Works
10+-------------------------------
11+This test shows that the mouse still works normally while keynav mode is active.
12+
13+#. Press Alt+F1 to enter keynav mode
14+#. Using the mouse perform a normal action (such as dragging a window)
15+
16+Outcome
17+ The keynav mode exits, along with the mouse performing the normal action
18+ the user expects. Such as highlighting text, moving a window, clicking out
19+ of keynav mode, or clicking on a launcher icon. All these actions should
20+ also exit the keynav mode.
21+
22+Test Alt+F1 KeyNavMode Shortcuts
23+-----------------------------
24+This test shows that all the shortcuts work and also exits from keynav mode.
25+
26+#. Press Alt+F1 to enter keynav mode
27+#. Press Super + a
28+#. Press Esc
29+#. Press Alt+F1
30+#. Press Alt + Tab
31+#. Press Alt+F1
32+#. Press Ctrl + Alt + t
33+
34+Outcome
35+ The first shortcut opens the dash app lens, which it should open it and quit the
36+ nav mode. The second shortcut switches between applications. The last one will open
37+ a new terminal. This is to show all SUPER, ALT, and CTRL shortcuts work; while
38+ closing the keynav mode.
39+
40+Test Alt+F1 NavMode Quicklist Click Exit
41+----------------------------------------
42+This Test shows that clicking on a quicklist option quits keynav mode.
43+
44+#. Press Alt+F1 to enter keynav mode
45+#. Press Right arrow
46+#. Click on any option
47+
48+Outcome
49+ No matter what option you click will exit keynav mode.
50+
51
52=== modified file 'plugins/unityshell/src/LauncherController.cpp'
53--- plugins/unityshell/src/LauncherController.cpp 2012-02-01 00:06:29 +0000
54+++ plugins/unityshell/src/LauncherController.cpp 2012-02-02 03:21:18 +0000
55@@ -130,6 +130,8 @@
56
57 void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
58
59+ void OnWindowFocusChanged (guint32 xid);
60+
61 void ReceiveMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
62
63 void ReceiveLauncherKeyPress(unsigned long eventType,
64@@ -168,6 +170,7 @@
65 bool launcher_grabbed;
66 bool reactivate_keynav;
67 int reactivate_index;
68+ bool keynav_restore_window_;
69
70 UBusManager ubus;
71
72@@ -196,6 +199,7 @@
73 launcher_keynav = false;
74 launcher_grabbed = false;
75 reactivate_keynav = false;
76+ keynav_restore_window_ = true;
77
78 int i = 0;
79 for (auto monitor : monitors)
80@@ -242,6 +246,9 @@
81
82 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
83
84+ WindowManager& plugin_adapter = *(WindowManager::Default());
85+ plugin_adapter.window_focus_changed.connect (sigc::mem_fun (this, &Controller::Impl::OnWindowFocusChanged));
86+
87 launcher_key_press_time_ = { 0, 0 };
88
89 ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [&](GVariant * args) {
90@@ -277,6 +284,22 @@
91 launchers.resize(num_monitors);
92 }
93
94+void Controller::Impl::OnWindowFocusChanged (guint32 xid)
95+{
96+ static bool keynav_first_focus = false;
97+
98+ if (keynav_first_focus)
99+ {
100+ keynav_first_focus = false;
101+ keynav_restore_window_ = false;
102+ parent_->KeyNavTerminate(false);
103+ }
104+ else if (launcher_keynav)
105+ {
106+ keynav_first_focus = true;
107+ }
108+}
109+
110 Launcher* Controller::Impl::CreateLauncher(int monitor)
111 {
112 nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow"));
113@@ -1000,6 +1023,7 @@
114
115 pimpl->reactivate_keynav = false;
116 pimpl->launcher_keynav = true;
117+ pimpl->keynav_restore_window_ = true;
118 pimpl->keyboard_launcher_ = pimpl->launchers[pimpl->MonitorWithMouse()];
119 pimpl->keyboard_launcher_->ShowShortcuts(false);
120
121@@ -1007,6 +1031,7 @@
122 pimpl->model_->SetSelection(0);
123
124 pimpl->ubus.SendMessage(UBUS_LAUNCHER_START_KEY_SWTICHER, g_variant_new_boolean(true));
125+ pimpl->ubus.SendMessage(UBUS_LAUNCHER_START_KEY_NAV, NULL);
126 }
127
128 void Controller::KeyNavNext()
129@@ -1041,6 +1066,7 @@
130 pimpl->keyboard_launcher_.Release();
131
132 pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_SWTICHER, g_variant_new_boolean(true));
133+ pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_NAV, g_variant_new_boolean(pimpl->keynav_restore_window_));
134 }
135
136 bool Controller::KeyNavIsActive() const
137@@ -1094,7 +1120,11 @@
138 parent_->KeyNavNext();
139 break;
140
141- // esc/left (close quicklist or exit laucher key-focus)
142+ // super/control/alt/esc/left (close quicklist or exit laucher key-focus)
143+ case NUX_VK_LWIN:
144+ case NUX_VK_RWIN:
145+ case NUX_VK_CONTROL:
146+ case NUX_VK_MENU:
147 case NUX_VK_LEFT:
148 case NUX_KP_LEFT:
149 case NUX_VK_ESCAPE: