X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenuframe.c;h=b80bac9123e6722acb21d18a5535bb24c080b265;hb=43d62990e407f409f76f60a405c529f9b15d33f6;hp=b235f5eb459d93c5bef80d4d5a53abc22cb99215;hpb=3bd4397b6ec5212bfe53a36892746962dc45dbeb;p=chaz%2Fopenbox diff --git a/openbox/menuframe.c b/openbox/menuframe.c index b235f5eb..b80bac91 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -27,6 +27,7 @@ #include "openbox.h" #include "config.h" #include "obt/prop.h" +#include "obt/keyboard.h" #include "obrender/theme.h" #define PADDING 2 @@ -61,6 +62,19 @@ static Window createWindow(Window parent, gulong mask, RrVisual(ob_rr_inst), mask, attrib); } +static void client_dest(ObClient *client, gpointer data) +{ + GList *it; + + /* menus can be associated with a client, so null those refs since + we are disappearing now */ + for (it = menu_frame_visible; it; it = g_list_next(it)) { + ObMenuFrame *f = it->data; + if (f->client == client) + f->client = NULL; + } +} + void menu_frame_startup(gboolean reconfig) { gint i; @@ -75,6 +89,7 @@ void menu_frame_startup(gboolean reconfig) if (reconfig) return; + client_add_destroy_notify(client_dest, NULL); menu_frame_map = g_hash_table_new(g_int_hash, g_int_equal); } @@ -84,6 +99,7 @@ void menu_frame_shutdown(gboolean reconfig) if (reconfig) return; + client_remove_destroy_notify(client_dest); g_hash_table_destroy(menu_frame_map); } @@ -1090,22 +1106,6 @@ void menu_frame_hide_all(void) menu_frame_hide(it->data); } -void menu_frame_hide_all_client(ObClient *client) -{ - GList *it = g_list_last(menu_frame_visible); - if (it) { - ObMenuFrame *f = it->data; - if (f->client == client) { - if (config_submenu_show_delay) { - /* remove any submenu open requests */ - obt_main_loop_timeout_remove(ob_main_loop, - submenu_show_timeout); - } - menu_frame_hide(f); - } - } -} - ObMenuFrame* menu_frame_under(gint x, gint y) { ObMenuFrame *ret = NULL; @@ -1263,10 +1263,11 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state) GSList *acts = self->entry->data.normal.actions; ObClient *client = self->frame->client; ObMenuFrame *frame = self->frame; + guint mods = obt_keyboard_only_modmasks(state); /* release grabs before executing the shit */ - if (!(state & ControlMask)) { - menu_frame_hide_all(); + if (!(mods & ControlMask)) { + event_cancel_all_key_grabs(); frame = NULL; }