diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-09-19 17:40:26 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-09-19 17:40:26 +0000 |
| commit | 44fd94ff51239e99a604ccafec039c5453467508 (patch) | |
| tree | 309b5aeb112f65f67301205a717d8b7cef6d75b5 /openbox/action.c | |
| parent | 19e48200739dc95f9b0079a25849e7e06c99302c (diff) | |
only allow running lists of actions at a time, policy is to always allow multiple action bindings, so this enforces it, and at the same time, UngrabKeyboard() before firing actions if there are no interactive ones. This is needed for some execute's, namely gnome-panel-control --main-menu.
Diffstat (limited to 'openbox/action.c')
| -rw-r--r-- | openbox/action.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/openbox/action.c b/openbox/action.c index a395af2d..f780ce88 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -28,11 +28,12 @@ #include "openbox.h" #include "grab.h" #include "keyboard.h" +#include "event.h" #include <glib.h> typedef struct ActionString { - char *name; + const gchar *name; void (*func)(union ActionData *); void (*setup)(ObAction **, ObUserAction uact); } ActionString; @@ -784,27 +785,51 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, return act; } -void action_run_full(ObAction *a, struct _ObClient *c, +void action_run_list(GSList *acts, struct _ObClient *c, guint state, guint button, gint x, gint y, gboolean cancel, gboolean done) { + GSList *it; + ObAction *a; + gboolean inter = FALSE; + if (x < 0 && y < 0) screen_pointer_pos(&x, &y); - a->data.any.c = c; - a->data.any.x = x; - a->data.any.y = y; - - a->data.any.button = button; + for (it = acts; it; it = g_slist_next(it)) { + a = it->data; + if (a->data.any.interactive) { + inter = TRUE; + break; + } + } - if (a->data.any.interactive) { - a->data.inter.cancel = cancel; - a->data.inter.final = done; - if (!(cancel || done)) - keyboard_interactive_grab(state, c, a); + if (!inter) { + /* sometimes when we execute another app as an action, + it won't work right unless we XUngrabKeyboard first, + even though we grabbed the key/button Asychronously. + e.g. "gnome-panel-control --main-menu" */ + XUngrabKeyboard(ob_display, event_lasttime); } - a->func(&a->data); + for (it = acts; it; it = g_slist_next(it)) { + a = it->data; + + a->data.any.c = c; + a->data.any.x = x; + a->data.any.y = y; + + a->data.any.button = button; + + if (a->data.any.interactive) { + a->data.inter.cancel = cancel; + a->data.inter.final = done; + if (!(cancel || done)) + keyboard_interactive_grab(state, c, a); + } + + a->func(&a->data); + } } void action_execute(union ActionData *data) |
