Merge lp:~3v1n0/unity/super-tab-switcher-shortcut-interaction into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 1867
Proposed branch: lp:~3v1n0/unity/super-tab-switcher-shortcut-interaction
Merge into: lp:unity
Diff against target: 462 lines (+128/-97)
5 files modified
manual-tests/SuperTab.txt (+22/-0)
plugins/unityshell/src/ShortcutController.cpp (+52/-34)
plugins/unityshell/src/ShortcutController.h (+10/-5)
plugins/unityshell/src/unityshell.cpp (+39/-52)
plugins/unityshell/src/unityshell.h (+5/-6)
To merge this branch: bzr merge lp:~3v1n0/unity/super-tab-switcher-shortcut-interaction
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Tim Penhey (community) Approve
Review via email: mp+88608@code.launchpad.net

Description of the change

Fixed the logical interaction between lp:~3v1n0/unity/super-tab-switcher and lp:~andyrock/unity/shortcut-hint as defined by design.

Plus, some code improvements and fixed an issue that caused the shortcut hint to show when pressing Super and clicking over the BFB to show the dash.

I'm wondering if we should avoid the same also when pressing over the workspace switcher.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

>Plus, some code improvements and fixed an issue that caused the shortcut hint to show when pressing Super and clicking over the BFB to show the dash.

Which issue?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Never mind ;)

Revision history for this message
Andrea Azzarone (azzar1) wrote :

173 +bool Controller::IsEnabled()
174 +{
175 + return enabled_;
176 +}
177 +
178 +void Controller::SetEnabled(bool enabled)
179 +{
180 + enabled_ = enabled;
181 +}
182 +

Why not nux::Property enabled? What do you think?

+ optionSetShowMinimizedWindowsNotify (boost::bind(&UnityScreen::optionChanged, this, _1, _2));

Remove the space, please :)

271 +
272 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
273 + sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
274 +
275 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV,
276 + sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav));
277 +
278 + ubus_manager_.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV,
279 + sigc::mem_fun(this, &UnityScreen::OnQuicklistEndKeyNav));

Fix the indentation...

Btw it works well.

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> 173 +bool Controller::IsEnabled()
> 174 +{
> 175 + return enabled_;
> 176 +}
> 177 +
> 178 +void Controller::SetEnabled(bool enabled)
> 179 +{
> 180 + enabled_ = enabled;
> 181 +}
> 182 +
>
> Why not nux::Property enabled? What do you think?

Mh... I'd prefer using this way, but let me know what you prefer.

> + optionSetShowMinimizedWindowsNotify
> (boost::bind(&UnityScreen::optionChanged, this, _1, _2));
>
> Remove the space, please :)
>
> 271 +
> 272 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
> 273 +
> sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
> 274 +
> 275 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV,
> 276 +
> sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav));
> 277 +
> 278 + ubus_manager_.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV,
> 279 +
> sigc::mem_fun(this, &UnityScreen::OnQuicklistEndKeyNav));
>
> Fix the indentation...

Damned you! :D
This was an Easter egg for you! ^_^

> Btw it works well.

Nice.
Do you have any design input about how the interaction with the expo? (Should the overlay be hidden when using mouse to activate it?)

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> > 173 +bool Controller::IsEnabled()
> > 174 +{
> > 175 + return enabled_;
> > 176 +}
> > 177 +
> > 178 +void Controller::SetEnabled(bool enabled)
> > 179 +{
> > 180 + enabled_ = enabled;
> > 181 +}
> > 182 +
> >
> > Why not nux::Property enabled? What do you think?
>
> Mh... I'd prefer using this way, but let me know what you prefer.
>

I prefer nux::Property, but let decide Tim ;)

> > + optionSetShowMinimizedWindowsNotify
> > (boost::bind(&UnityScreen::optionChanged, this, _1, _2));
> >
> > Remove the space, please :)
> >
> > 271 +
> > 272 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
> > 273 +
> > sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
> > 274 +
> > 275 + ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV,
> > 276 +
> > sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav));
> > 277 +
> > 278 + ubus_manager_.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV,
> > 279 +
> > sigc::mem_fun(this, &UnityScreen::OnQuicklistEndKeyNav));
> >
> > Fix the indentation...
>
> Damned you! :D
> This was an Easter egg for you! ^_^
>
> > Btw it works well.
>
> Nice.
> Do you have any design input about how the interaction with the expo? (Should
> the overlay be hidden when using mouse to activate it?)

No.

Revision history for this message
Tim Penhey (thumper) wrote :

I wouldn't get too hung up on it. Your indentation is still off in a few places, but not blocking.

Perhaps this is worth writing an autopilot test for?

You would need to expose the shortcut controller :)

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Well, I guess that the autopilot test could be included into the generic launcher switcher test...

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'manual-tests/SuperTab.txt'
--- manual-tests/SuperTab.txt 2012-01-13 15:51:12 +0000
+++ manual-tests/SuperTab.txt 2012-01-19 23:43:23 +0000
@@ -20,3 +20,25 @@
20 If in the launcher there are many icons and they are shown as collapsed,20 If in the launcher there are many icons and they are shown as collapsed,
21 when the Super+Tab is activated and the icons should be expanded when21 when the Super+Tab is activated and the icons should be expanded when
22 neeeded.22 neeeded.
23
24Super Tab switcher interaction with Shortcut Hint
25-------------------------------------------------
26This test shows the interaction between the shortcut hint overlay and the
27Super+Tab switcher.
28
29#. Start with a clean screen
30#. Press Super to make the shortcuts-overlay to show
31#. Then press Tab to initiate the Super+Tab launcher switcher
32
33Outcome:
34 The Super+Tab switcher is initialized, and the shortcut hint overlay is still
35 showing. Pressing also Shift to reverse the switcher direction doesn't hide
36 the overlay, that will be hidden once Super is released.
37
38#. Start with a clean screen
39#. Press Super+Tab quickly to make the launcher switcher to initialize without
40 making the shortcut overlay to show.
41
42Outcome:
43 Super+Tab switcher is initialized and the shortcut hint overlay is not shown
44 even keeping only super pressed until releasing it and pressing it again.
2345
=== modified file 'plugins/unityshell/src/ShortcutController.cpp'
--- plugins/unityshell/src/ShortcutController.cpp 2011-12-19 22:42:19 +0000
+++ plugins/unityshell/src/ShortcutController.cpp 2012-01-19 23:43:23 +0000
@@ -19,7 +19,6 @@
19#include "ShortcutController.h"19#include "ShortcutController.h"
2020
21#include "UBusMessages.h"21#include "UBusMessages.h"
22#include "ubus-server.h"
23#include "WindowManager.h"22#include "WindowManager.h"
2423
25namespace unity24namespace unity
@@ -34,39 +33,43 @@
34Controller::Controller(std::list<AbstractHint*>& hints)33Controller::Controller(std::list<AbstractHint*>& hints)
35 : view_window_(0)34 : view_window_(0)
36 , visible_(false)35 , visible_(false)
36 , enabled_(true)
37 , show_timer_(0)37 , show_timer_(0)
38 , fade_in_animator_(new Animator(100))38 , fade_in_animator_(100)
39 , fade_out_animator_(new Animator(100))39 , fade_out_animator_(100)
40
41{40{
42 bg_color_ = nux::Color(0.0, 0.0, 0.0, 0.5);41 bg_color_ = nux::Color(0.0, 0.0, 0.0, 0.5);
4342
44 UBusServer *ubus = ubus_server_get_default();43 ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED,
45 bg_update_handle_ = ubus_server_register_interest(ubus, UBUS_BACKGROUND_COLOR_CHANGED,44 sigc::mem_fun(this, &Controller::OnBackgroundUpdate));
46 (UBusCallback)&Controller::OnBackgroundUpdate,45
47 this);46 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWTICHER, [&] (GVariant*) {
47 enabled_ = false;
48 });
49
50 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_SWTICHER, [&] (GVariant*) {
51 enabled_ = true;
52 });
53
54 ubus_manager_.RegisterInterest(UBUS_PLACE_VIEW_SHOWN, [&] (GVariant*) {
55 Hide();
56 });
57
58 ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT);
4859
49 model_.reset(new Model(hints));60 model_.reset(new Model(hints));
50 61
51 model_->Fill();62 model_->Fill();
52 ConstructView();63 ConstructView();
5364
54 fade_in_animator_->animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeInUpdated));65 fade_in_animator_.animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeInUpdated));
55 fade_in_animator_->animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeInEnded));66 fade_in_animator_.animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeInEnded));
56 fade_out_animator_->animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeOutUpdated));67 fade_out_animator_.animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeOutUpdated));
57 fade_out_animator_->animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeOutEnded));68 fade_out_animator_.animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeOutEnded));
58}69}
5970
60Controller::~Controller()71Controller::~Controller()
61{72{
62 ubus_server_unregister_interest(ubus_server_get_default(), bg_update_handle_);
63
64 if (fade_in_animator_)
65 delete fade_in_animator_;
66
67 if (fade_out_animator_)
68 delete fade_out_animator_;
69
70 if (view_window_)73 if (view_window_)
71 view_window_->UnReference();74 view_window_->UnReference();
72 75
@@ -96,21 +99,23 @@
96}99}
97100
98101
99void Controller::OnBackgroundUpdate(GVariant* data, Controller* self)102void Controller::OnBackgroundUpdate(GVariant* data)
100{103{
101 gdouble red, green, blue, alpha;104 gdouble red, green, blue, alpha;
102 g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha);105 g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha);
103 self->bg_color_ = nux::Color(red, green, blue, alpha);106 bg_color_ = nux::Color(red, green, blue, alpha);
104107
105 if (self->view_)108 if (view_)
106 self->view_->background_color = self->bg_color_;109 view_->background_color = bg_color_;
107}110}
108111
109void Controller::Show()112void Controller::Show()
110{113{
111 if (show_timer_)114 if (show_timer_)
112 g_source_remove (show_timer_);115 g_source_remove (show_timer_);
113 show_timer_ = g_timeout_add(SUPER_TAP_DURATION, &Controller::OnShowTimer, this);116
117 if (enabled_)
118 show_timer_ = g_timeout_add(SUPER_TAP_DURATION, &Controller::OnShowTimer, this);
114119
115 model_->Fill();120 model_->Fill();
116 visible_ = true;121 visible_ = true;
@@ -119,16 +124,19 @@
119gboolean Controller::OnShowTimer(gpointer data)124gboolean Controller::OnShowTimer(gpointer data)
120{125{
121 Controller* self = static_cast<Controller*>(data);126 Controller* self = static_cast<Controller*>(data);
122 127
123 ubus_server_send_message(ubus_server_get_default(),128 if (!self->enabled_)
124 UBUS_PLACE_VIEW_CLOSE_REQUEST,129 {
125 NULL);130 return FALSE;
131 }
132
133 self->ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
126134
127 if (self->visible_)135 if (self->visible_)
128 {136 {
129 self->view_->SetupBackground(true);137 self->view_->SetupBackground(true);
130 self->fade_out_animator_->Stop();138 self->fade_out_animator_.Stop();
131 self->fade_in_animator_->Start(self->view_window_->GetOpacity());139 self->fade_in_animator_.Start(self->view_window_->GetOpacity());
132 }140 }
133141
134 self->show_timer_ = 0;142 self->show_timer_ = 0;
@@ -176,8 +184,8 @@
176 if (view_window_)184 if (view_window_)
177 {185 {
178 view_->SetupBackground(false);186 view_->SetupBackground(false);
179 fade_in_animator_->Stop();187 fade_in_animator_.Stop();
180 fade_out_animator_->Start(1.0 - view_window_->GetOpacity());188 fade_out_animator_.Start(1.0 - view_window_->GetOpacity());
181 }189 }
182190
183 if (show_timer_)191 if (show_timer_)
@@ -190,5 +198,15 @@
190 return visible_;198 return visible_;
191}199}
192200
201bool Controller::IsEnabled()
202{
203 return enabled_;
204}
205
206void Controller::SetEnabled(bool enabled)
207{
208 enabled_ = enabled;
209}
210
193} // namespace shortcut211} // namespace shortcut
194} // namespace unity212} // namespace unity
195213
=== modified file 'plugins/unityshell/src/ShortcutController.h'
--- plugins/unityshell/src/ShortcutController.h 2011-12-13 23:31:20 +0000
+++ plugins/unityshell/src/ShortcutController.h 2012-01-19 23:43:23 +0000
@@ -29,6 +29,7 @@
29#include "Animator.h"29#include "Animator.h"
30#include "ShortcutModel.h"30#include "ShortcutModel.h"
31#include "ShortcutView.h"31#include "ShortcutView.h"
32#include "UBusWrapper.h"
3233
33namespace unity34namespace unity
34{35{
@@ -49,13 +50,15 @@
49 void Hide();50 void Hide();
50 51
51 bool Visible();52 bool Visible();
53 bool IsEnabled();
5254
53 void SetWorkspace(nux::Geometry const& geo);55 void SetWorkspace(nux::Geometry const& geo);
56 void SetEnabled(bool enabled);
5457
55private:58private:
56 // Private Methods59 // Private Methods
57 void ConstructView();60 void ConstructView();
58 static void OnBackgroundUpdate(GVariant* data, Controller* self);61 void OnBackgroundUpdate(GVariant* data);
59 void OnFadeInUpdated(double opacity);62 void OnFadeInUpdated(double opacity);
60 void OnFadeInEnded();63 void OnFadeInEnded();
61 void OnFadeOutUpdated(double opacity);64 void OnFadeOutUpdated(double opacity);
@@ -72,13 +75,15 @@
72 nux::HLayout* main_layout_;75 nux::HLayout* main_layout_;
73 76
74 bool visible_;77 bool visible_;
78 bool enabled_;
75 nux::Color bg_color_;79 nux::Color bg_color_;
76 guint show_timer_;80 guint show_timer_;
77 guint bg_update_handle_;
78 81
79 Animator* fade_in_animator_;82 Animator fade_in_animator_;
80 Animator* fade_out_animator_;83 Animator fade_out_animator_;
81}; 84
85 UBusManager ubus_manager_;
86};
8287
83} // namespace shortcut88} // namespace shortcut
84} // namespace unity89} // namespace unity
8590
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-01-19 15:13:35 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-01-19 23:43:23 +0000
@@ -52,7 +52,6 @@
5252
53#include "unitya11y.h"53#include "unitya11y.h"
5454
55#include "ubus-server.h"
56#include "UBusMessages.h"55#include "UBusMessages.h"
57#include "UScreen.h"56#include "UScreen.h"
5857
@@ -294,26 +293,16 @@
294 optionSetLauncherSwitcherPrevInitiate(boost::bind(&UnityScreen::launcherSwitcherPrevInitiate, this, _1, _2, _3));293 optionSetLauncherSwitcherPrevInitiate(boost::bind(&UnityScreen::launcherSwitcherPrevInitiate, this, _1, _2, _3));
295 optionSetLauncherSwitcherForwardTerminate(boost::bind(&UnityScreen::launcherSwitcherTerminate, this, _1, _2, _3));294 optionSetLauncherSwitcherForwardTerminate(boost::bind(&UnityScreen::launcherSwitcherTerminate, this, _1, _2, _3));
296295
297 optionSetShowMinimizedWindowsNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));296 optionSetShowMinimizedWindowsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
298297
299 for (unsigned int i = 0; i < G_N_ELEMENTS(_ubus_handles); i++)298 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
300 _ubus_handles[i] = 0;299 sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
301300
302 UBusServer* ubus = ubus_server_get_default();301 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV,
303 _ubus_handles[0] = ubus_server_register_interest(ubus,302 sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav));
304 UBUS_LAUNCHER_START_KEY_NAV,303
305 (UBusCallback)&UnityScreen::OnLauncherStartKeyNav,304 ubus_manager_.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV,
306 this);305 sigc::mem_fun(this, &UnityScreen::OnQuicklistEndKeyNav));
307
308 _ubus_handles[1] = ubus_server_register_interest(ubus,
309 UBUS_LAUNCHER_END_KEY_NAV,
310 (UBusCallback)&UnityScreen::OnLauncherEndKeyNav,
311 this);
312
313 _ubus_handles[2] = ubus_server_register_interest(ubus,
314 UBUS_QUICKLIST_END_KEY_NAV,
315 (UBusCallback)&UnityScreen::OnQuicklistEndKeyNav,
316 this);
317306
318 g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::initPluginActions, this, NULL);307 g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::initPluginActions, this, NULL);
319 super_keypressed_ = false;308 super_keypressed_ = false;
@@ -343,13 +332,6 @@
343332
344 unity_a11y_finalize();333 unity_a11y_finalize();
345334
346 UBusServer* ubus = ubus_server_get_default();
347 for (unsigned int i = 0; i < G_N_ELEMENTS(_ubus_handles); i++)
348 {
349 if (_ubus_handles[i] != 0)
350 ubus_server_unregister_interest(ubus, _ubus_handles[i]);
351 }
352
353 if (relayoutSourceId != 0)335 if (relayoutSourceId != 0)
354 g_source_remove(relayoutSourceId);336 g_source_remove(relayoutSourceId);
355337
@@ -1129,7 +1111,16 @@
1129 key_string[result] = 0;1111 key_string[result] = 0;
1130 if (super_keypressed_)1112 if (super_keypressed_)
1131 {1113 {
1132 shortcut_controller_->Hide();1114 g_idle_add([] (gpointer data) -> gboolean {
1115 auto self = static_cast<UnityScreen*>(data);
1116 if (!self->launcher_controller_->launcher().KeySwitcherIsActive())
1117 {
1118 self->shortcut_controller_->SetEnabled(false);
1119 self->shortcut_controller_->Hide();
1120 }
1121 return FALSE;
1122 }, this);
1123
1133 skip_other_plugins = launcher.CheckSuperShortcutPressed(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string);1124 skip_other_plugins = launcher.CheckSuperShortcutPressed(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string);
1134 if (!skip_other_plugins)1125 if (!skip_other_plugins)
1135 {1126 {
@@ -1225,10 +1216,9 @@
1225 PluginAdapter::Default()->NotifyCompizEvent(plugin, event, option);1216 PluginAdapter::Default()->NotifyCompizEvent(plugin, event, option);
1226 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent (plugin, event, option);1217 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent (plugin, event, option);
12271218
1228 if (dash_is_open_ && 1219 if (dash_is_open_ && g_strcmp0(event, "start_viewport_switch") == 0)
1229 strcmp(event, "start_viewport_switch") == 0)
1230 {1220 {
1231 ubus_server_send_message(ubus_server_get_default(), UBUS_PLACE_VIEW_CLOSE_REQUEST, NULL);1221 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
1232 }1222 }
12331223
1234 screen->handleCompizEvent(plugin, event, option);1224 screen->handleCompizEvent(plugin, event, option);
@@ -1245,33 +1235,33 @@
1245 super_keypressed_ = true;1235 super_keypressed_ = true;
1246 launcher_controller_->launcher().StartKeyShowLauncher();1236 launcher_controller_->launcher().StartKeyShowLauncher();
1247 EnsureSuperKeybindings ();1237 EnsureSuperKeybindings ();
1248 1238
1249 if (enable_shortcut_overlay_ and !shortcut_controller_->Visible())1239 if (!shortcut_controller_->Visible() && shortcut_controller_->IsEnabled())
1250 {1240 {
1251 static nux::Geometry last_geo;1241 static nux::Geometry last_geo;
1252 UScreen* uscreen = UScreen::GetDefault();1242 UScreen* uscreen = UScreen::GetDefault();
1253 int primary_monitor = uscreen->GetPrimaryMonitor();1243 int primary_monitor = uscreen->GetPrimaryMonitor();
1254 auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);1244 auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);
1255 1245
1256 int width = 970;1246 int width = 970;
1257 int height = 680;1247 int height = 680;
1258 int launcher_width = optionGetIconSize() + 18;1248 int launcher_width = optionGetIconSize() + 18;
1259 int panel_height = 24;1249 int panel_height = 24;
1260 int x = monitor_geo.x + launcher_width + (monitor_geo.width - launcher_width- width) / 2;1250 int x = monitor_geo.x + launcher_width + (monitor_geo.width - launcher_width- width) / 2;
1261 int y = monitor_geo.y + panel_height + (monitor_geo.height - panel_height - height) / 2;1251 int y = monitor_geo.y + panel_height + (monitor_geo.height - panel_height - height) / 2;
1262 1252
1263 nux::Geometry geo (x, y, width, height);1253 nux::Geometry geo (x, y, width, height);
1264 1254
1265 if (last_geo != geo)1255 if (last_geo != geo)
1266 {1256 {
1267 shortcut_controller_->SetWorkspace(geo);1257 shortcut_controller_->SetWorkspace(geo);
1268 last_geo = geo;1258 last_geo = geo;
1269 }1259 }
1270 1260
1271 if (last_geo.x > monitor_geo.x and last_geo.y > monitor_geo.y)1261 if (last_geo.x > monitor_geo.x and last_geo.y > monitor_geo.y)
1272 shortcut_controller_->Show();1262 shortcut_controller_->Show();
1273 }1263 }
1274 1264
1275 return false;1265 return false;
1276}1266}
12771267
@@ -1282,6 +1272,8 @@
1282 super_keypressed_ = false;1272 super_keypressed_ = false;
1283 launcher_controller_->launcher().EndKeyShowLauncher();1273 launcher_controller_->launcher().EndKeyShowLauncher();
1284 launcher_controller_->launcher().KeySwitcherTerminate();1274 launcher_controller_->launcher().KeySwitcherTerminate();
1275
1276 shortcut_controller_->SetEnabled(enable_shortcut_overlay_);
1285 shortcut_controller_->Hide();1277 shortcut_controller_->Hide();
1286 return false;1278 return false;
1287}1279}
@@ -1370,12 +1362,8 @@
13701362
1371void UnityScreen::SendExecuteCommand()1363void UnityScreen::SendExecuteCommand()
1372{1364{
1373 ubus_server_send_message(ubus_server_get_default(),1365 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
1374 UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,1366 g_variant_new("(sus)", "commands.lens", 0, ""));
1375 g_variant_new("(sus)",
1376 "commands.lens",
1377 0,
1378 ""));
1379}1367}
13801368
1381bool UnityScreen::executeCommand(CompAction* action,1369bool UnityScreen::executeCommand(CompAction* action,
@@ -1563,13 +1551,12 @@
1563 return false;1551 return false;
1564}1552}
15651553
1566void UnityScreen::OnLauncherStartKeyNav(GVariant* data, void* value)1554void UnityScreen::OnLauncherStartKeyNav(GVariant* data)
1567{1555{
1568 UnityScreen* self = reinterpret_cast<UnityScreen*>(value);1556 startLauncherKeyNav();
1569 self->startLauncherKeyNav();
1570}1557}
15711558
1572void UnityScreen::OnLauncherEndKeyNav(GVariant* data, void* value)1559void UnityScreen::OnLauncherEndKeyNav(GVariant* data)
1573{1560{
1574 bool preserve_focus = false;1561 bool preserve_focus = false;
15751562
@@ -1584,10 +1571,9 @@
1584 PluginAdapter::Default ()->restoreInputFocus ();1571 PluginAdapter::Default ()->restoreInputFocus ();
1585}1572}
15861573
1587void UnityScreen::OnQuicklistEndKeyNav(GVariant* data, void* value)1574void UnityScreen::OnQuicklistEndKeyNav(GVariant* data)
1588{1575{
1589 UnityScreen* self = reinterpret_cast<UnityScreen*>(value);1576 restartLauncherKeyNav();
1590 self->restartLauncherKeyNav();
1591}1577}
15921578
1593gboolean UnityScreen::initPluginActions(gpointer data)1579gboolean UnityScreen::initPluginActions(gpointer data)
@@ -2242,6 +2228,7 @@
2242 break;2228 break;
2243 case UnityshellOptions::ShortcutOverlay:2229 case UnityshellOptions::ShortcutOverlay:
2244 enable_shortcut_overlay_ = optionGetShortcutOverlay();2230 enable_shortcut_overlay_ = optionGetShortcutOverlay();
2231 shortcut_controller_->SetEnabled(enable_shortcut_overlay_);
2245 break;2232 break;
2246 case UnityshellOptions::ShowDesktopIcon:2233 case UnityshellOptions::ShowDesktopIcon:
2247 launcher_controller_->SetShowDesktopIcon(optionGetShowDesktopIcon());2234 launcher_controller_->SetShowDesktopIcon(optionGetShowDesktopIcon());
22482235
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-01-14 13:05:16 +0000
+++ plugins/unityshell/src/unityshell.h 2012-01-19 23:43:23 +0000
@@ -245,10 +245,10 @@
245245
246 void OnDashRealized ();246 void OnDashRealized ();
247247
248 static void OnQuicklistEndKeyNav(GVariant* data, void* value);248 void OnQuicklistEndKeyNav(GVariant* data);
249 static void OnLauncherStartKeyNav(GVariant* data, void* value);249 void OnLauncherStartKeyNav(GVariant* data);
250 static void OnLauncherEndKeyNav(GVariant* data, void* value);250 void OnLauncherEndKeyNav(GVariant* data);
251 251
252 void InitHints();252 void InitHints();
253253
254 dash::Settings dash_settings_;254 dash::Settings dash_settings_;
@@ -277,8 +277,7 @@
277 guint _edge_trigger_handle;277 guint _edge_trigger_handle;
278 guint32 _redraw_handle;278 guint32 _redraw_handle;
279 gint _edge_pointerY;279 gint _edge_pointerY;
280 guint _ubus_handles[3];280
281
282 typedef std::shared_ptr<CompAction> CompActionPtr;281 typedef std::shared_ptr<CompAction> CompActionPtr;
283 typedef std::vector<CompActionPtr> ShortcutActions;282 typedef std::vector<CompActionPtr> ShortcutActions;
284 ShortcutActions _shortcut_actions;283 ShortcutActions _shortcut_actions;