From: Dana Jansens Date: Sat, 11 Oct 2003 16:19:17 +0000 (+0000) Subject: gracefully handle grabs failing when doing interactive actions X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=055aa5cd7411c4563956e376523219afc6198ce1;p=chaz%2Fopenbox gracefully handle grabs failing when doing interactive actions --- diff --git a/openbox/action.c b/openbox/action.c index 35a649b0..5f8b306f 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -946,7 +946,8 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, a->data.inter.cancel = cancel; a->data.inter.final = done; if (!(cancel || done)) - keyboard_interactive_grab(state, a->data.any.c, a); + if (!keyboard_interactive_grab(state, a->data.any.c, a)) + continue; /* interactive actions are not queued */ a->func(&a->data); diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 11b3a985..05d40cd0 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -155,8 +155,8 @@ gboolean keyboard_bind(GList *keylist, ObAction *action) return TRUE; } -void keyboard_interactive_grab(guint state, ObClient *client, - ObAction *action) +gboolean keyboard_interactive_grab(guint state, ObClient *client, + ObAction *action) { ObInteractiveState *s; @@ -164,10 +164,10 @@ void keyboard_interactive_grab(guint state, ObClient *client, if (!interactive_states) { if (!grab_keyboard(TRUE)) - return; + return FALSE; if (!grab_pointer(TRUE, OB_CURSOR_NONE)) { grab_keyboard(FALSE); - return; + return FALSE; } } @@ -178,6 +178,8 @@ void keyboard_interactive_grab(guint state, ObClient *client, s->actions = g_slist_append(NULL, action); interactive_states = g_slist_append(interactive_states, s); + + return TRUE; } void keyboard_interactive_end(ObInteractiveState *s, diff --git a/openbox/keyboard.h b/openbox/keyboard.h index be181bd7..8a9eb47f 100644 --- a/openbox/keyboard.h +++ b/openbox/keyboard.h @@ -39,8 +39,8 @@ void keyboard_unbind_all(); void keyboard_event(struct _ObClient *client, const XEvent *e); void keyboard_reset_chains(); -void keyboard_interactive_grab(guint state, struct _ObClient *client, - struct _ObAction *action); +gboolean keyboard_interactive_grab(guint state, struct _ObClient *client, + struct _ObAction *action); gboolean keyboard_process_interactive_grab(const XEvent *e, struct _ObClient **client);