From 4f6f573f4d7e3812eae1450956e12573dd68cab4 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Mon, 17 Feb 2014 18:52:15 +0100 Subject: shell: add a way of listening to other widgets for enter/leave Due to the many widgets in the panel, some enter and leave signals get eaten up by some widgets here and there, so their ::enter-notify-event should be connected to to make sure the cursor is still over the panel. ::leave-notify-event isn't required as the panel will always give us a reliable final leave event. The reason why these signals are signalled or not signalled are not fully understood. --- shell/gtk-shell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shell/gtk-shell.c b/shell/gtk-shell.c index 278dab6..feffb1e 100644 --- a/shell/gtk-shell.c +++ b/shell/gtk-shell.c @@ -41,6 +41,11 @@ struct desktop { guint initial_panel_timeout_id; guint hide_panel_idle_id; + + /* queue of widgets on which to connect to the + * enter-notify-event signal so we know we're still on the + * panel. */ + GQueue *panel_widgets; }; /* TODO: guessed from the mockups, it'd be nice to have this in stone @@ -58,6 +63,7 @@ static gboolean connect_enter_leave_signals (gpointer data) { struct desktop *desktop = data; + GList *l; g_signal_connect (desktop->panel->window, "enter-notify-event", G_CALLBACK (panel_window_enter_cb), desktop); @@ -69,6 +75,11 @@ connect_enter_leave_signals (gpointer data) g_signal_connect (desktop->clock->window, "leave-notify-event", G_CALLBACK (panel_window_leave_cb), desktop); + for (l = desktop->panel_widgets->head; l != NULL; l = l->next) { + g_signal_connect (l->data, "enter-notify-event", + G_CALLBACK (panel_window_enter_cb), desktop); + } + return FALSE; } @@ -465,6 +476,7 @@ main(int argc, char *argv[]) desktop->output = NULL; desktop->shell = NULL; desktop->helper = NULL; + desktop->panel_widgets = g_queue_new (); desktop->gdk_display = gdk_display_get_default(); desktop->display = -- cgit v1.3.1