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
1=== modified file 'src/BamfLauncherIcon.cpp'
2--- src/BamfLauncherIcon.cpp 2011-02-03 17:31:47 +0000
3+++ src/BamfLauncherIcon.cpp 2011-02-07 08:24:28 +0000
4@@ -25,6 +25,9 @@
5 #include "PluginAdapter.h"
6 #include "FavoriteStore.h"
7
8+#include "ubus-server.h"
9+#include "UBusMessages.h"
10+
11 #include <glib/gi18n-lib.h>
12 #include <gio/gdesktopappinfo.h>
13 #include <libindicator/indicator-desktop-shortcuts.h>
14@@ -394,6 +397,7 @@
15 return;
16
17 Activate ();
18+ ubus_server_send_message (ubus_server_get_default (), UBUS_LAUNCHER_ACTION_DONE, NULL);
19 }
20
21 void
22
23=== modified file 'src/Launcher.cpp'
24--- src/Launcher.cpp 2011-02-03 20:19:33 +0000
25+++ src/Launcher.cpp 2011-02-07 08:24:28 +0000
26@@ -289,6 +289,7 @@
27 _key_show_launcher = false;
28 _placeview_show_launcher = false;
29 _window_over_launcher = false;
30+ _hide_on_action_done = false;
31 _render_drag_window = false;
32 _backlight_always_on = false;
33 _last_button_press = 0;
34@@ -323,6 +324,10 @@
35 ubus_server_register_interest (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE,
36 (UBusCallback)&Launcher::OnTriggerUpdate,
37 this);
38+
39+ ubus_server_register_interest (ubus, UBUS_LAUNCHER_ACTION_DONE,
40+ (UBusCallback)&Launcher::OnActionDone,
41+ this);
42 }
43
44 Launcher::~Launcher()
45@@ -1032,25 +1037,22 @@
46 {
47 _key_show_launcher = true;
48 EnsureHiddenState ();
49- // trigger the timer now as we want to hide the launcher immediately
50- // if we release the key after 1s happened.
51- SetupAutohideTimer ();
52 }
53
54 void Launcher::EndKeyShowLauncher ()
55 {
56 _key_show_launcher = false;
57- EnsureHiddenState ();
58+ if (_hide_on_action_done)
59+ EnsureHiddenState ();
60+ else
61+ SetupAutohideTimer ();
62 }
63
64 void Launcher::OnPlaceViewShown (GVariant *data, void *val)
65 {
66 Launcher *self = (Launcher*)val;
67 self->_placeview_show_launcher = true;
68- // trigger the timer now as we want to hide the launcher immediately
69- // if we close the dash after 1s happened.
70 self->EnsureHiddenState ();
71- self->SetupAutohideTimer ();
72 }
73
74 void Launcher::OnPlaceViewHidden (GVariant *data, void *val)
75@@ -1096,6 +1098,13 @@
76 }
77 }
78
79+void Launcher::OnActionDone (GVariant *data, void *val)
80+{
81+ Launcher *self = (Launcher*)val;
82+ self->_hide_on_action_done = true;
83+ self->SetupAutohideTimer ();
84+}
85+
86 void Launcher::SetHidden (bool hidden)
87 {
88 if (hidden == _hidden)
89@@ -1122,7 +1131,8 @@
90 Launcher::EnsureHiddenState ()
91 {
92 if (!_mouse_inside_trigger &&
93- !_mouse_inside_launcher &&
94+ (!_mouse_inside_launcher ||
95+ (_mouse_inside_launcher && _hide_on_action_done)) &&
96 !_key_show_launcher &&
97 !_placeview_show_launcher &&
98 _launcher_action_state == ACTION_NONE &&
99@@ -2244,6 +2254,8 @@
100 launcher_icon->MouseEnter.emit ();
101 launcher_icon->_mouse_inside = true;
102 _icon_under_mouse = launcher_icon;
103+ // reset trigger has the mouse moved to another item
104+ _hide_on_action_done = false;
105 }
106 }
107
108
109=== modified file 'src/Launcher.h'
110--- src/Launcher.h 2011-02-03 17:31:47 +0000
111+++ src/Launcher.h 2011-02-07 08:24:28 +0000
112@@ -238,6 +238,8 @@
113
114 static void OnTriggerUpdate (GVariant *data, gpointer user_data);
115
116+ static void OnActionDone (GVariant *data, void *val);
117+
118 void RenderIndicators (nux::GraphicsEngine& GfxContext,
119 RenderArg const &arg,
120 int running,
121@@ -306,6 +308,7 @@
122 bool _key_show_launcher;
123 bool _placeview_show_launcher;
124 bool _window_over_launcher;
125+ bool _hide_on_action_done;
126 bool _render_drag_window;
127 bool _backlight_always_on;
128
129
130=== modified file 'src/UBusMessages.h'
131--- src/UBusMessages.h 2011-02-03 17:31:47 +0000
132+++ src/UBusMessages.h 2011-02-07 08:24:28 +0000
133@@ -42,4 +42,7 @@
134 #define UBUS_LAUNCHER_EXIT_KEY_NAV "LAUNCHER_EXIT_KEY_NAV"
135 #define UBUS_QUICKLIST_EXIT_KEY_NAV "QUICKLIST_EXIT_KEY_NAV"
136
137+// Signal to send on icon action and that you want to request hiding the launcher
138+#define UBUS_LAUNCHER_ACTION_DONE "LAUNCHER_ACTION_DONE"
139+
140 #endif // UBUS_MESSAGES_H