Merge lp:~loic.molinari/unity/unity-keyboard-navigation into lp:unity

Proposed by Loïc Molinari
Status: Merged
Merge reported by: Mirco Müller
Merged at revision: not available
Proposed branch: lp:~loic.molinari/unity/unity-keyboard-navigation
Merge into: lp:unity
Diff against target: 119 lines (+43/-1)
5 files modified
src/Launcher.cpp (+19/-0)
src/Launcher.h (+3/-0)
src/unityshell.cpp (+12/-0)
src/unityshell.h (+4/-1)
unityshell.xml.in (+5/-0)
To merge this branch: bzr merge lp:~loic.molinari/unity/unity-keyboard-navigation
Reviewer Review Type Date Requested Status
Neil J. Patel Pending
Review via email: mp+47540@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2011-01-26 14:11:37 +0000
3+++ src/Launcher.cpp 2011-01-26 15:39:45 +0000
4@@ -188,6 +188,9 @@
5 OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));
6 OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));
7
8+ OnKeyPressed.connect (sigc::mem_fun (this, &Launcher::RecvKeyPressed));
9+ OnKeyReleased.connect (sigc::mem_fun (this, &Launcher::RecvKeyReleased));
10+
11 QuicklistManager::Default ()->quicklist_opened.connect (sigc::mem_fun(this, &Launcher::RecvQuicklistOpened));
12 QuicklistManager::Default ()->quicklist_closed.connect (sigc::mem_fun(this, &Launcher::RecvQuicklistClosed));
13
14@@ -1950,6 +1953,22 @@
15 EnsureAnimation ();
16 }
17
18+void Launcher::RecvKeyPressed (unsigned int key_sym, unsigned long key_code,
19+ unsigned long key_state)
20+{
21+ // FIXME(loicm) Hey Mirco, now you can put your stuff here ...
22+ fprintf (stdout, "Launcher::RecvKeyPressed (%d, %ld, %ld)\n", key_sym,
23+ key_code, key_state);
24+}
25+
26+void Launcher::RecvKeyReleased (unsigned int key_sym, unsigned long key_code,
27+ unsigned long key_state)
28+{
29+ // FIXME(loicm) ... and there ;)
30+ fprintf (stdout, "Launcher::RecvKeyReleased (%d, %ld, %ld)\n", key_sym,
31+ key_code, key_state);
32+}
33+
34 void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)
35 {
36 EventLogic ();
37
38=== modified file 'src/Launcher.h'
39--- src/Launcher.h 2011-01-24 11:26:31 +0000
40+++ src/Launcher.h 2011-01-26 15:39:45 +0000
41@@ -108,6 +108,9 @@
42 virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
43 virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
44
45+ virtual void RecvKeyPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
46+ virtual void RecvKeyReleased (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
47+
48 virtual void RecvQuicklistOpened (QuicklistView *quicklist);
49 virtual void RecvQuicklistClosed (QuicklistView *quicklist);
50
51
52=== modified file 'src/unityshell.cpp'
53--- src/unityshell.cpp 2011-01-24 10:44:25 +0000
54+++ src/unityshell.cpp 2011-01-26 15:39:45 +0000
55@@ -209,6 +209,17 @@
56 return false;
57 }
58
59+bool
60+UnityScreen::navigateLauncherKeyInitiate (CompAction *action,
61+ CompAction::State state,
62+ CompOption::Vector &options)
63+{
64+ CompWindow *w = screen->findWindow (launcherWindow->GetInputWindowId ());
65+ if (w != NULL)
66+ w->moveInputFocusTo ();
67+ return false;
68+}
69+
70 gboolean
71 UnityScreen::initPluginActions (gpointer data)
72 {
73@@ -487,6 +498,7 @@
74 optionSetUrgentAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
75 optionSetShowLauncherInitiate (boost::bind (&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
76 optionSetShowLauncherTerminate (boost::bind (&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
77+ optionSetNavigateLauncherInitiate (boost::bind (&UnityScreen::navigateLauncherKeyInitiate, this, _1, _2, _3));
78
79 g_timeout_add (0, &UnityScreen::initPluginActions, this);
80 g_timeout_add (5000, (GSourceFunc) write_logger_data_to_disk, NULL);
81
82=== modified file 'src/unityshell.h'
83--- src/unityshell.h 2011-01-20 04:06:54 +0000
84+++ src/unityshell.h 2011-01-26 15:39:45 +0000
85@@ -100,6 +100,9 @@
86 showLauncherKeyTerminate (CompAction *action, CompAction::State state,
87 CompOption::Vector &options);
88
89+ bool navigateLauncherKeyInitiate (CompAction *action, CompAction::State state,
90+ CompOption::Vector &options);
91+
92 /* handle option changes and change settings inside of the
93 * panel and dock views */
94 void optionChanged (CompOption *, Options num);
95@@ -155,7 +158,7 @@
96 bool damaged;
97 CompWindowList _withRemovedNuxWindows;
98
99- friend class UnityWindow;
100+ friend class UnityWindow;
101 };
102
103 class UnityWindow :
104
105=== modified file 'unityshell.xml.in'
106--- unityshell.xml.in 2011-01-04 16:16:10 +0000
107+++ unityshell.xml.in 2011-01-26 15:39:45 +0000
108@@ -49,6 +49,11 @@
109 <_long>Make the launcher appear with that key</_long>
110 <default>&lt;Super&gt;</default>
111 </option>
112+ <option name="navigate_launcher" type="key">
113+ <_short>Navigate launcher</_short>
114+ <_long>Navigate the launcher with the keyboard</_long>
115+ <default>&lt;Alt&gt;F1</default>
116+ </option>
117 </group>
118 <group>
119 <_short>Experimental</_short>