Merge lp:~didrocks/unity/fix-709178 into lp:unity

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 832
Proposed branch: lp:~didrocks/unity/fix-709178
Merge into: lp:unity
Diff against target: 140 lines (+30/-8)
4 files modified
src/BamfLauncherIcon.cpp (+4/-0)
src/Launcher.cpp (+20/-8)
src/Launcher.h (+3/-0)
src/UBusMessages.h (+3/-0)
To merge this branch: bzr merge lp:~didrocks/unity/fix-709178
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+48758@code.launchpad.net

Description of the change

hide the launcher after an action without triggering another action. (LP:
#709178)

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

+1 merging since you are in FOSDEM, enjoy yourself :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/BamfLauncherIcon.cpp'
--- src/BamfLauncherIcon.cpp 2011-02-03 17:31:47 +0000
+++ src/BamfLauncherIcon.cpp 2011-02-07 08:24:28 +0000
@@ -25,6 +25,9 @@
25#include "PluginAdapter.h"25#include "PluginAdapter.h"
26#include "FavoriteStore.h"26#include "FavoriteStore.h"
2727
28#include "ubus-server.h"
29#include "UBusMessages.h"
30
28#include <glib/gi18n-lib.h>31#include <glib/gi18n-lib.h>
29#include <gio/gdesktopappinfo.h>32#include <gio/gdesktopappinfo.h>
30#include <libindicator/indicator-desktop-shortcuts.h>33#include <libindicator/indicator-desktop-shortcuts.h>
@@ -394,6 +397,7 @@
394 return;397 return;
395398
396 Activate ();399 Activate ();
400 ubus_server_send_message (ubus_server_get_default (), UBUS_LAUNCHER_ACTION_DONE, NULL);
397}401}
398402
399void403void
400404
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2011-02-03 20:19:33 +0000
+++ src/Launcher.cpp 2011-02-07 08:24:28 +0000
@@ -289,6 +289,7 @@
289 _key_show_launcher = false;289 _key_show_launcher = false;
290 _placeview_show_launcher = false;290 _placeview_show_launcher = false;
291 _window_over_launcher = false;291 _window_over_launcher = false;
292 _hide_on_action_done = false;
292 _render_drag_window = false;293 _render_drag_window = false;
293 _backlight_always_on = false;294 _backlight_always_on = false;
294 _last_button_press = 0;295 _last_button_press = 0;
@@ -323,6 +324,10 @@
323 ubus_server_register_interest (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE,324 ubus_server_register_interest (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE,
324 (UBusCallback)&Launcher::OnTriggerUpdate,325 (UBusCallback)&Launcher::OnTriggerUpdate,
325 this);326 this);
327
328 ubus_server_register_interest (ubus, UBUS_LAUNCHER_ACTION_DONE,
329 (UBusCallback)&Launcher::OnActionDone,
330 this);
326}331}
327332
328Launcher::~Launcher()333Launcher::~Launcher()
@@ -1032,25 +1037,22 @@
1032{1037{
1033 _key_show_launcher = true;1038 _key_show_launcher = true;
1034 EnsureHiddenState ();1039 EnsureHiddenState ();
1035 // trigger the timer now as we want to hide the launcher immediately
1036 // if we release the key after 1s happened.
1037 SetupAutohideTimer ();
1038}1040}
10391041
1040void Launcher::EndKeyShowLauncher ()1042void Launcher::EndKeyShowLauncher ()
1041{1043{
1042 _key_show_launcher = false;1044 _key_show_launcher = false;
1043 EnsureHiddenState ();1045 if (_hide_on_action_done)
1046 EnsureHiddenState ();
1047 else
1048 SetupAutohideTimer ();
1044}1049}
10451050
1046void Launcher::OnPlaceViewShown (GVariant *data, void *val)1051void Launcher::OnPlaceViewShown (GVariant *data, void *val)
1047{1052{
1048 Launcher *self = (Launcher*)val;1053 Launcher *self = (Launcher*)val;
1049 self->_placeview_show_launcher = true;1054 self->_placeview_show_launcher = true;
1050 // trigger the timer now as we want to hide the launcher immediately
1051 // if we close the dash after 1s happened.
1052 self->EnsureHiddenState ();1055 self->EnsureHiddenState ();
1053 self->SetupAutohideTimer ();
1054}1056}
10551057
1056void Launcher::OnPlaceViewHidden (GVariant *data, void *val)1058void Launcher::OnPlaceViewHidden (GVariant *data, void *val)
@@ -1096,6 +1098,13 @@
1096 }1098 }
1097}1099}
10981100
1101void Launcher::OnActionDone (GVariant *data, void *val)
1102{
1103 Launcher *self = (Launcher*)val;
1104 self->_hide_on_action_done = true;
1105 self->SetupAutohideTimer ();
1106}
1107
1099void Launcher::SetHidden (bool hidden)1108void Launcher::SetHidden (bool hidden)
1100{1109{
1101 if (hidden == _hidden)1110 if (hidden == _hidden)
@@ -1122,7 +1131,8 @@
1122Launcher::EnsureHiddenState ()1131Launcher::EnsureHiddenState ()
1123{1132{
1124 if (!_mouse_inside_trigger && 1133 if (!_mouse_inside_trigger &&
1125 !_mouse_inside_launcher && 1134 (!_mouse_inside_launcher ||
1135 (_mouse_inside_launcher && _hide_on_action_done)) &&
1126 !_key_show_launcher &&1136 !_key_show_launcher &&
1127 !_placeview_show_launcher &&1137 !_placeview_show_launcher &&
1128 _launcher_action_state == ACTION_NONE &&1138 _launcher_action_state == ACTION_NONE &&
@@ -2244,6 +2254,8 @@
2244 launcher_icon->MouseEnter.emit ();2254 launcher_icon->MouseEnter.emit ();
2245 launcher_icon->_mouse_inside = true;2255 launcher_icon->_mouse_inside = true;
2246 _icon_under_mouse = launcher_icon;2256 _icon_under_mouse = launcher_icon;
2257 // reset trigger has the mouse moved to another item
2258 _hide_on_action_done = false;
2247 }2259 }
2248}2260}
22492261
22502262
=== modified file 'src/Launcher.h'
--- src/Launcher.h 2011-02-03 17:31:47 +0000
+++ src/Launcher.h 2011-02-07 08:24:28 +0000
@@ -238,6 +238,8 @@
238 238
239 static void OnTriggerUpdate (GVariant *data, gpointer user_data);239 static void OnTriggerUpdate (GVariant *data, gpointer user_data);
240240
241 static void OnActionDone (GVariant *data, void *val);
242
241 void RenderIndicators (nux::GraphicsEngine& GfxContext,243 void RenderIndicators (nux::GraphicsEngine& GfxContext,
242 RenderArg const &arg,244 RenderArg const &arg,
243 int running,245 int running,
@@ -306,6 +308,7 @@
306 bool _key_show_launcher;308 bool _key_show_launcher;
307 bool _placeview_show_launcher;309 bool _placeview_show_launcher;
308 bool _window_over_launcher;310 bool _window_over_launcher;
311 bool _hide_on_action_done;
309 bool _render_drag_window;312 bool _render_drag_window;
310 bool _backlight_always_on;313 bool _backlight_always_on;
311314
312315
=== modified file 'src/UBusMessages.h'
--- src/UBusMessages.h 2011-02-03 17:31:47 +0000
+++ src/UBusMessages.h 2011-02-07 08:24:28 +0000
@@ -42,4 +42,7 @@
42#define UBUS_LAUNCHER_EXIT_KEY_NAV "LAUNCHER_EXIT_KEY_NAV"42#define UBUS_LAUNCHER_EXIT_KEY_NAV "LAUNCHER_EXIT_KEY_NAV"
43#define UBUS_QUICKLIST_EXIT_KEY_NAV "QUICKLIST_EXIT_KEY_NAV"43#define UBUS_QUICKLIST_EXIT_KEY_NAV "QUICKLIST_EXIT_KEY_NAV"
4444
45// Signal to send on icon action and that you want to request hiding the launcher
46#define UBUS_LAUNCHER_ACTION_DONE "LAUNCHER_ACTION_DONE"
47
45#endif // UBUS_MESSAGES_H48#endif // UBUS_MESSAGES_H