Merge lp:~robertcarr/unity/tab-lens-navigation into lp:unity

Proposed by Robert Carr
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1533
Proposed branch: lp:~robertcarr/unity/tab-lens-navigation
Merge into: lp:unity
Diff against target: 113 lines (+60/-0)
5 files modified
plugins/unityshell/src/DashView.cpp (+8/-0)
plugins/unityshell/src/DashView.h (+2/-0)
plugins/unityshell/src/IMTextEntry.cpp (+4/-0)
plugins/unityshell/src/LensBar.cpp (+43/-0)
plugins/unityshell/src/LensBar.h (+3/-0)
To merge this branch: bzr merge lp:~robertcarr/unity/tab-lens-navigation
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+74917@code.launchpad.net

Description of the change

Implement tab and shift tab navigation support to switch between lenses. Depends on https://code.launchpad.net/~robertcarr/nux/nux-keynav-tabprev/+merge/74916 to work.

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
=== modified file 'plugins/unityshell/src/DashView.cpp'
--- plugins/unityshell/src/DashView.cpp 2011-09-08 12:43:05 +0000
+++ plugins/unityshell/src/DashView.cpp 2011-09-11 17:02:15 +0000
@@ -820,6 +820,14 @@
820void DashView::AddProperties(GVariantBuilder* builder)820void DashView::AddProperties(GVariantBuilder* builder)
821{}821{}
822822
823nux::Area * DashView::KeyNavIteration(nux::KeyNavDirection direction)
824{
825 if (direction == KEY_NAV_TAB_NEXT)
826 lens_bar_->ActivateNext();
827 else if (direction == KEY_NAV_TAB_PREVIOUS)
828 lens_bar_->ActivatePrevious();
829 return this;
830}
823831
824}832}
825}833}
826834
=== modified file 'plugins/unityshell/src/DashView.h'
--- plugins/unityshell/src/DashView.h 2011-09-08 11:23:14 +0000
+++ plugins/unityshell/src/DashView.h 2011-09-11 17:02:15 +0000
@@ -93,6 +93,8 @@
93 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);93 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
94 const gchar* GetName();94 const gchar* GetName();
95 void AddProperties(GVariantBuilder* builder);95 void AddProperties(GVariantBuilder* builder);
96
97 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
9698
97private:99private:
98 UBusManager ubus_manager_;100 UBusManager ubus_manager_;
99101
=== modified file 'plugins/unityshell/src/IMTextEntry.cpp'
--- plugins/unityshell/src/IMTextEntry.cpp 2011-09-07 17:03:52 +0000
+++ plugins/unityshell/src/IMTextEntry.cpp 2011-09-11 17:02:15 +0000
@@ -193,6 +193,10 @@
193 {193 {
194 Paste();194 Paste();
195 }195 }
196 else if (keyval == NUX_VK_TAB || keyval == NUX_VK_LEFT_TAB)
197 {
198 return true;
199 }
196 else200 else
197 {201 {
198 return false;202 return false;
199203
=== modified file 'plugins/unityshell/src/LensBar.cpp'
--- plugins/unityshell/src/LensBar.cpp 2011-09-07 21:45:10 +0000
+++ plugins/unityshell/src/LensBar.cpp 2011-09-11 17:02:15 +0000
@@ -140,6 +140,49 @@
140 lens_activated.emit(activated->id);140 lens_activated.emit(activated->id);
141}141}
142142
143void LensBar::ActivateNext()
144{
145 bool activate_next = false;
146 for (auto it = icons_.begin();
147 it < icons_.end();
148 it++)
149 {
150 LensBarIcon *icon = *it;
151
152 if (activate_next && icon->IsVisible())
153 {
154 SetActive(icon);
155 return;
156 }
157 if (icon->active)
158 activate_next = true;
159 }
160 SetActive(icons_[0]);
161
162}
163
164void LensBar::ActivatePrevious()
165{
166 bool activate_previous = false;
167
168 for (auto it = icons_.rbegin();
169 it < icons_.rend();
170 ++it)
171 {
172 LensBarIcon *icon = *it;
173
174 if (activate_previous && icon->IsVisible())
175 {
176 SetActive(icon);
177 return;
178 }
179 if (icon->active)
180 activate_previous = true;
181 }
182 SetActive(icons_.back());
183
184}
185
143// Keyboard navigation186// Keyboard navigation
144bool LensBar::AcceptKeyNavFocus()187bool LensBar::AcceptKeyNavFocus()
145{188{
146189
=== modified file 'plugins/unityshell/src/LensBar.h'
--- plugins/unityshell/src/LensBar.h 2011-08-22 17:17:26 +0000
+++ plugins/unityshell/src/LensBar.h 2011-09-11 17:02:15 +0000
@@ -48,6 +48,9 @@
4848
49 void AddLens(Lens::Ptr& lens);49 void AddLens(Lens::Ptr& lens);
50 void Activate(std::string id);50 void Activate(std::string id);
51 void ActivateNext();
52 void ActivatePrevious();
53
5154
52 sigc::signal<void, std::string const&> lens_activated;55 sigc::signal<void, std::string const&> lens_activated;
5356