[Xfce4-commits] <xfce4-taskbar-plugin:master> Added some more intelligence into the menu logic, prepping for complete migration away from popup menu to the hover menu.
Gearoid Murphy
noreply at xfce.org
Tue Oct 9 15:02:06 CEST 2012
Updating branch refs/heads/master
to 8ec01766e0861a2cccaab6c2b390c2fe7b2547bb (commit)
from 654baa449c4af3243c7c54ccc158404e69917ecb (commit)
commit 8ec01766e0861a2cccaab6c2b390c2fe7b2547bb
Author: Gearoid Murphy <gearoid.murphy at hp.com>
Date: Tue Oct 9 13:57:15 2012 +0100
Added some more intelligence into the menu logic, prepping for complete migration away from popup menu to the hover menu.
Makefile | 4 ++--
taskbar-widget.c | 24 ++++++++++++++++++++----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 82101e5..7b35fea 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-#CFLAGS=-fPIC -g -I. `pkg-config --cflags-only-I gtk+-2.0 exo-1 libwnck-1.0 libxfce4panel-1.0 libxfce4ui-1 libxfconf-0 gtkhotkey-1.0`
-CFLAGS=-fPIC -O3 -I. `pkg-config --cflags-only-I gtk+-2.0 exo-1 libwnck-1.0 libxfce4panel-1.0 libxfce4ui-1 libxfconf-0 gtkhotkey-1.0`
+CFLAGS=-fPIC -g -I. `pkg-config --cflags-only-I gtk+-2.0 exo-1 libwnck-1.0 libxfce4panel-1.0 libxfce4ui-1 libxfconf-0 gtkhotkey-1.0`
+#CFLAGS=-fPIC -O3 -I. `pkg-config --cflags-only-I gtk+-2.0 exo-1 libwnck-1.0 libxfce4panel-1.0 libxfce4ui-1 libxfconf-0 gtkhotkey-1.0`
LINKFLAGS=`pkg-config --libs gtk+-2.0 exo-1 libwnck-1.0 libxfce4panel-1.0 libxfce4ui-1 libxfconf-0 gobject-2.0 gtk+-x11-2.0 glib-2.0 gtkhotkey-1.0`
OBJ=taskbar.o taskbar-widget.o hotkeys.o
diff --git a/taskbar-widget.c b/taskbar-widget.c
index bc79951..476e14f 100644
--- a/taskbar-widget.c
+++ b/taskbar-widget.c
@@ -253,6 +253,9 @@ static void xfce_taskbar_group_button_build_launch_menu (XfceTaskBarGroup *g
static void xfce_taskbar_group_button_build_pin_menu (XfceTaskBarGroup *group, GtkWidget *menu);
static void cache_pinned_configuration (XfceTaskBar *taskbar);
+//hover menu functions
+static gboolean trigger_hover_menu_timeout(GtkWidget *widget, GdkEvent *event, gpointer menu_ptr);
+
// potential public functions
static void xfce_taskbar_set_include_all_workspaces (XfceTaskBar *taskbar, gboolean all_workspaces);
static void xfce_taskbar_set_include_all_monitors (XfceTaskBar *taskbar, gboolean all_monitors);
@@ -1586,7 +1589,7 @@ static gboolean xfce_taskbar_app_button_release_event (GtkWidget *button, GdkEve
return FALSE ;
}
- //Sanity check the buttons, to be sure to be sure :)
+ //Sanity check the buttons
if(event->button < LEFTMOUSE || event->button > RIGHTMOUSE)
return FALSE ;
@@ -2315,9 +2318,24 @@ static gboolean xfce_taskbar_group_button_release_event
}
else
{
- /* Split the particular menu use cases into seperate functions*/
+ /* Split the particular menu use cases into separate functions*/
if(event->button == LEFTMOUSE)
{
+ //We need to check if the hover menu is active
+ if(visible_count > 1)
+ {
+ GList *attached = gtk_menu_get_for_attach_widget(group->button);
+ guint list_length = g_list_length(attached);
+ panel_assert (list_length <= 1 && "There should only be at most one menu attached to the icon!");
+ if(list_length == 1)
+ {
+ GtkMenu *menu = attached->data;
+ g_signal_handlers_disconnect_by_func(group->button, trigger_hover_menu_timeout, menu);
+ gtk_widget_destroy (GTK_WIDGET(menu));
+ return TRUE ;
+ }
+ }
+
menu = xfce_taskbar_group_button_menu_show_active (group);
}
else
@@ -2340,8 +2358,6 @@ static gboolean xfce_taskbar_group_button_release_event
return FALSE;
}
-static gboolean trigger_hover_menu_timeout(GtkWidget *widget, GdkEvent *event, gpointer menu_ptr);
-
//This callback gets triggered if the mouse has left the group icon but has not entered the hover menu
static gboolean xfce_taskbar_hover_menu_timeout(gpointer menu_ptr)
{
More information about the Xfce4-commits
mailing list