1
=== modified file 'UnityCore/DBusIndicators.cpp'
2
--- a/UnityCore/DBusIndicators.cpp 2011-08-01 14:24:34 +0000
3
+++ b/UnityCore/DBusIndicators.cpp 2011-07-29 10:18:29 +0000
8
+ else if (signal_name == "ActiveMenuPointerMotion")
12
+ g_variant_get(parameters, "(ii)", &x, &y);
13
+ owner_->on_menu_pointer_moved.emit(x, y);
15
else if (signal_name == "EntryShowNowChanged")
19
=== modified file 'UnityCore/Indicators.h'
20
--- a/UnityCore/Indicators.h 2011-07-29 07:15:54 +0000
21
+++ b/UnityCore/Indicators.h 2011-07-21 20:24:04 +0000
23
sigc::signal<void, Indicator::Ptr const&> on_object_removed;
26
+ * This signal is emitted when an entry is activated and the user moves the
28
+ * @param x x coordinate
29
+ * @param y y coordinate
31
+ sigc::signal<void, int, int> on_menu_pointer_moved;
34
* Service wants the view to activate an entry.
35
* Example use-case: user has activated an entry with the mouse and pressed
36
* Left or Right key to activate previous or next entry.
38
=== modified file 'plugins/unityshell/src/PanelIndicatorObjectEntryView.cpp'
39
--- a/plugins/unityshell/src/PanelIndicatorObjectEntryView.cpp 2011-07-29 07:15:54 +0000
40
+++ b/plugins/unityshell/src/PanelIndicatorObjectEntryView.cpp 2011-07-22 14:04:58 +0000
42
GetAbsoluteY() + PANEL_HEIGHT,
44
nux::GetEventButton(button_flags));
45
- proxy_->set_active(true);
47
- // ^ Set active even before the menu appears. This allows the below
48
- // Refresh call to know it should draw_menu_bg() immediately
49
- // rather than waiting for slow inter-process communication with
50
- // unity-panel-service, which causes visible lag in many cases.
61
void PanelIndicatorObjectEntryView::OnMouseUp(int x, int y, long button_flags, long key_flags)
63
=== modified file 'plugins/unityshell/src/PanelView.cpp'
64
--- a/plugins/unityshell/src/PanelView.cpp 2011-07-29 08:55:26 +0000
65
+++ b/plugins/unityshell/src/PanelView.cpp 2011-07-28 11:02:56 +0000
68
_remote = indicator::DBusIndicators::Ptr(new indicator::DBusIndicators());
69
_remote->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded));
70
+ _remote->on_menu_pointer_moved.connect(sigc::mem_fun(this, &PanelView::OnMenuPointerMoved));
71
_remote->on_entry_activate_request.connect(sigc::mem_fun(this, &PanelView::OnEntryActivateRequest));
72
_remote->on_entry_activated.connect(sigc::mem_fun(this, &PanelView::OnEntryActivated));
73
_remote->on_synced.connect(sigc::mem_fun(this, &PanelView::OnSynced));
76
// request the latest colour from bghash
77
ubus_server_send_message (ubus, UBUS_BACKGROUND_REQUEST_COLOUR_EMIT, NULL);
79
- _track_menu_pointer_id = 0;
82
PanelView::~PanelView()
84
- if (_track_menu_pointer_id)
85
- g_source_remove(_track_menu_pointer_id);
86
_style->UnReference();
87
UBusServer *ubus = ubus_server_get_default();
88
ubus_server_unregister_interest(ubus, _handle_bg_color_update);
93
-static gboolean track_menu_pointer(gpointer data)
95
- PanelView *self = (PanelView*)data;
97
- gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL);
98
- self->OnMenuPointerMoved(x, y);
102
void PanelView::OnEntryActivated(std::string const& entry_id)
104
- bool active = (entry_id.size() > 0);
105
- if (active && !_track_menu_pointer_id)
108
- // Track menus being scrubbed at 60Hz (about every 16 millisec)
109
- // It might sound ugly, but it's far nicer (and more responsive) than the
110
- // code it replaces which used to capture motion events in another process
111
- // (unity-panel-service) and send them to us over dbus.
112
- // NOTE: The reason why we have to use a timer instead of tracking motion
113
- // events is because the motion events will never be delivered to this
114
- // process. All the motion events will go to unity-panel-service while
115
- // scrubbing because the active panel menu has (needs) the pointer grab.
117
- _track_menu_pointer_id = g_timeout_add(16, track_menu_pointer, this);
121
- if (_track_menu_pointer_id)
123
- g_source_remove(_track_menu_pointer_id);
124
- _track_menu_pointer_id = 0;
126
+ if (entry_id == "")
127
_menu_view->AllMenusClosed();
131
void PanelView::OnSynced()
133
=== modified file 'plugins/unityshell/src/PanelView.h'
134
--- a/plugins/unityshell/src/PanelView.h 2011-07-29 07:15:54 +0000
135
+++ b/plugins/unityshell/src/PanelView.h 2011-07-28 11:02:56 +0000
137
guint _handle_dash_hidden;
138
guint _handle_dash_shown;
139
guint _handle_bg_color_update;
140
- guint _track_menu_pointer_id;
145
=== modified file 'services/panel-main.c'
146
--- a/services/panel-main.c 2011-07-29 07:15:54 +0000
147
+++ b/services/panel-main.c 2011-07-21 20:24:04 +0000
149
" <arg type='s' name='indicator_id' />"
152
+ " <signal name='ActiveMenuPointerMotion'>"
153
+ " <arg type='i' name='x' />"
154
+ " <arg type='i' name='y' />"
157
" <signal name='EntryActivateRequest'>"
158
" <arg type='s' name='entry_id' />"
164
+on_service_active_menu_pointer_motion (PanelService *service,
165
+ GDBusConnection *connection)
167
+ GError *error = NULL;
170
+ panel_service_get_last_xy (service, &x, &y);
172
+ g_dbus_connection_emit_signal (connection,
176
+ "ActiveMenuPointerMotion",
177
+ g_variant_new ("(ii)", x, y),
182
+ g_warning ("Unable to emit ActiveMenuPointerMotionsignal: %s", error->message);
183
+ g_error_free (error);
188
on_service_entry_activate_request (PanelService *service,
189
const gchar *entry_id,
190
GDBusConnection *connection)
192
G_CALLBACK (on_service_resync), connection);
193
g_signal_connect (service, "entry-activated",
194
G_CALLBACK (on_service_entry_activated), connection);
195
+ g_signal_connect (service, "active-menu-pointer-motion",
196
+ G_CALLBACK (on_service_active_menu_pointer_motion), connection);
197
g_signal_connect (service, "entry-activate-request",
198
G_CALLBACK (on_service_entry_activate_request), connection);
199
g_signal_connect (service, "entry-show-now-changed",
202
g_signal_handlers_disconnect_by_func (service, on_service_resync, connection);
203
g_signal_handlers_disconnect_by_func (service, on_service_entry_activated, connection);
204
+ g_signal_handlers_disconnect_by_func (service, on_service_active_menu_pointer_motion, connection);
205
g_signal_handlers_disconnect_by_func (service, on_service_entry_activate_request, connection);
206
g_signal_handlers_disconnect_by_func (service, on_service_entry_show_now_changed, connection);
209
=== modified file 'services/panel-service.c'
210
--- a/services/panel-service.c 2011-07-29 07:15:54 +0000
211
+++ b/services/panel-service.c 2011-07-22 14:05:38 +0000
215
guint32 last_menu_button;
226
+ ACTIVE_MENU_POINTER_MOTION,
227
ENTRY_ACTIVATE_REQUEST,
228
ENTRY_SHOW_NOW_CHANGED,
231
g_cclosure_marshal_VOID__STRING,
232
G_TYPE_NONE, 1, G_TYPE_STRING);
234
+ _service_signals[ACTIVE_MENU_POINTER_MOTION] =
235
+ g_signal_new ("active-menu-pointer-motion",
236
+ G_OBJECT_CLASS_TYPE (obj_class),
240
+ g_cclosure_marshal_VOID__VOID,
243
_service_signals[ENTRY_ACTIVATE_REQUEST] =
244
g_signal_new ("entry-activate-request",
245
G_OBJECT_CLASS_TYPE (obj_class),
248
priv->last_menu_button = 0;
250
+ else if (event && event->evtype == XI_Motion)
252
+ priv->last_menu_x = event->root_x;
253
+ priv->last_menu_y = event->root_y;
255
+ if (priv->last_menu_y <= priv->last_y)
257
+ g_signal_emit (self, _service_signals[ACTIVE_MENU_POINTER_MOTION], 0);
263
@@ -1162,3 +1185,11 @@
264
abs(delta/120), direction);
268
+panel_service_get_last_xy (PanelService *self,
272
+ *x = self->priv->last_menu_x;
273
+ *y = self->priv->last_menu_y;
276
=== modified file 'services/panel-service.h'
277
--- a/services/panel-service.h 2011-07-29 07:15:54 +0000
278
+++ b/services/panel-service.h 2011-07-21 20:24:04 +0000
280
const gchar *entry_id,
283
+void panel_service_get_last_xy (PanelService *self,
289
#endif /* _PANEL_SERVICE_H_ */