Merge lp:~unity-team/unity/unity-fix-keynav-861251 into lp:unity

Proposed by Jay Taoko
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1645
Proposed branch: lp:~unity-team/unity/unity-fix-keynav-861251
Merge into: lp:unity
Diff against target: 82 lines (+62/-0)
2 files modified
plugins/unityshell/src/DashView.cpp (+54/-0)
plugins/unityshell/src/DashView.h (+8/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity-fix-keynav-861251
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+77369@code.launchpad.net

Description of the change

Fix key navigation bug. See bug #861251

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashView.cpp'
2--- plugins/unityshell/src/DashView.cpp 2011-09-28 09:35:16 +0000
3+++ plugins/unityshell/src/DashView.cpp 2011-09-28 17:05:35 +0000
4@@ -889,5 +889,59 @@
5 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
6 }
7
8+Area* DashView::FindKeyFocusArea(unsigned int key_symbol,
9+ unsigned long x11_key_code,
10+ unsigned long special_keys_state)
11+{
12+ // Do what nux::View does, but if the event isn't a key navigation,
13+ // designate the text entry to process it.
14+
15+ nux::KeyNavDirection direction = KEY_NAV_NONE;
16+ switch (x11_key_code)
17+ {
18+ case NUX_VK_UP:
19+ direction = KEY_NAV_UP;
20+ break;
21+ case NUX_VK_DOWN:
22+ direction = KEY_NAV_DOWN;
23+ break;
24+ case NUX_VK_LEFT:
25+ direction = KEY_NAV_LEFT;
26+ break;
27+ case NUX_VK_RIGHT:
28+ direction = KEY_NAV_RIGHT;
29+ break;
30+ case NUX_VK_LEFT_TAB:
31+ direction = KEY_NAV_TAB_PREVIOUS;
32+ break;
33+ case NUX_VK_TAB:
34+ direction = KEY_NAV_TAB_NEXT;
35+ break;
36+ case NUX_VK_ENTER:
37+ case NUX_KP_ENTER:
38+ // Not sure if Enter should be a navigation key
39+ direction = KEY_NAV_ENTER;
40+ break;
41+ default:
42+ direction = KEY_NAV_NONE;
43+ break;
44+ }
45+
46+ if (has_key_focus_)
47+ {
48+ return this;
49+ }
50+ else if (direction == KEY_NAV_NONE)
51+ {
52+ // then send the event to the search entry
53+ return search_bar_->text_entry();
54+ }
55+ else if (next_object_to_key_focus_area_)
56+ {
57+ return next_object_to_key_focus_area_->FindKeyFocusArea(key_symbol, x11_key_code, special_keys_state);
58+ }
59+ return NULL;
60+}
61+
62 }
63 }
64
65=== modified file 'plugins/unityshell/src/DashView.h'
66--- plugins/unityshell/src/DashView.h 2011-09-26 10:13:37 +0000
67+++ plugins/unityshell/src/DashView.h 2011-09-28 17:05:35 +0000
68@@ -64,6 +64,14 @@
69 protected:
70 void ProcessDndEnter();
71
72+ // virtual bool InspectKeyEvent(unsigned int eventType,
73+ // unsigned int keysym,
74+ // const char* character);
75+
76+ virtual Area* FindKeyFocusArea(unsigned int key_symbol,
77+ unsigned long x11_key_code,
78+ unsigned long special_keys_state);
79+
80 private:
81 void SetupBackground();
82 void SetupViews();