From: Darren S. <li...@yo...> - 2007-03-16 20:11:31
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1174075557 0 # Node ID 70c1d45a2a4e3514ca9ec9e27af9e25debcf63c8 # Parent 096e0a91298c5dd7b0e5783f200d47699bda40b2 Split out menu popup shortcut lookup. diff -r 70c1d45a2a4e3514ca9ec9e27af9e25debcf63c8 -r 096e0a91298c5dd7b0e5783f200d47699bda40b2 src/key_events.c --- a/src/key_events.c Fri Mar 16 20:05:57 2007 +0000 +++ b/src/key_events.c Fri Mar 16 16:21:33 2007 +0000 @@ -166,22 +166,28 @@ static key_binding_t *lookup_binding (Gt return k; } - -static gboolean is_menu_accel (GtkWidget *w, const GdkEventKey *event) -{ - guint keyval = 0; - GdkModifierType mods = 0; +void get_menu_bar_accel (GtkWidget *w, guint *keyval, GdkModifierType *mods) +{ gchar *accelstr; g_object_get (gtk_widget_get_settings (w), "gtk-menu-bar-accel", &accelstr, NULL); if (accelstr) { - gtk_accelerator_parse (accelstr, &keyval, &mods); + gtk_accelerator_parse (accelstr, keyval, mods); free (accelstr); } if (!keyval) + { keyval = GDK_F10; /* default binding */ - + mods = GDK_SHIFT_MASK; + } +} + +static gboolean is_menu_accel (GtkWidget *w, const GdkEventKey *event) +{ + guint keyval; + GdkModifierType mods; + get_menu_bar_accel (w, &keyval, &mods); return event->keyval == keyval && (event->state & GXINE_MODIFIER_MASK) == (mods & GXINE_MODIFIER_MASK); } diff -r 70c1d45a2a4e3514ca9ec9e27af9e25debcf63c8 -r 096e0a91298c5dd7b0e5783f200d47699bda40b2 src/key_events.h --- a/src/key_events.h Fri Mar 16 20:05:57 2007 +0000 +++ b/src/key_events.h Fri Mar 16 16:21:33 2007 +0000 @@ -37,6 +37,8 @@ struct kb_xine_event_map_s { }; typedef struct kb_xine_event_map_s kb_xine_event_map_t; +void get_menu_bar_accel (GtkWidget *, guint *, GdkModifierType *); + gboolean keypress_cb (GtkWidget *, GdkEventKey *, gpointer); gboolean buttonpress_cb (GtkWidget *, GdkEventButton *, gpointer); gboolean buttonrelease_cb (GtkWidget *, GdkEventButton *, gpointer); |