X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fkeyboard.c;h=ccfe04977c755ec23ef29815a6dde78be06bb9be;hb=f2890f35b706e169a14240a10a849fa83f35ba25;hp=c1151eb392eda2b8bb803c37390a08ae12148d63;hpb=1a300ab37243af326ef24f5e2f3b9903ae993a5c;p=chaz%2Fopenbox diff --git a/openbox/keyboard.c b/openbox/keyboard.c index c1151eb3..ccfe0497 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -27,6 +27,7 @@ #include "client.h" #include "action.h" #include "prop.h" +#include "menuframe.h" #include "config.h" #include "keytree.h" #include "keyboard.h" @@ -75,14 +76,6 @@ static gboolean chain_timeout(gpointer data) return FALSE; /* don't repeat */ } -static gboolean popup_show_timeout(gpointer data) -{ - gchar *text = data; - popup_show(popup, text); - - return FALSE; /* don't repeat */ -} - static void set_curpos(KeyBindingTree *newpos) { grab_keys(FALSE); @@ -103,19 +96,11 @@ static void set_curpos(KeyBindingTree *newpos) } popup_position(popup, NorthWestGravity, 10, 10); - if (popup->mapped) { - popup_show_timeout(text); - g_free(text); - } else { - ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout); - /* 1 second delay for the popup to show */ - ob_main_loop_timeout_add(ob_main_loop, G_USEC_PER_SEC, - popup_show_timeout, text, - g_direct_equal, g_free); - } + /* 1 second delay for the popup to show */ + popup_delay_show(popup, G_USEC_PER_SEC, text); + g_free(text); } else { popup_hide(popup); - ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout); } } @@ -313,6 +298,10 @@ void keyboard_event(ObClient *client, const XEvent *e) if (p->key == e->xkey.keycode && p->state == e->xkey.state) { + /* if we hit a key binding, then close any open menus and run it */ + if (menu_frame_visible) + menu_frame_hide_all(); + if (p->first_child != NULL) { /* part of a chain */ ob_main_loop_timeout_remove(ob_main_loop, chain_timeout); /* 3 second timeout for chains */ @@ -362,7 +351,6 @@ void keyboard_shutdown(gboolean reconfig) interactive_states = NULL; ob_main_loop_timeout_remove(ob_main_loop, chain_timeout); - ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout); keyboard_unbind_all(); set_curpos(NULL);