]> Dogcows Code - chaz/openbox/commitdiff
only allow running lists of actions at a time, policy is to always allow multiple...
authorDana Jansens <danakj@orodu.net>
Fri, 19 Sep 2003 17:40:26 +0000 (17:40 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 19 Sep 2003 17:40:26 +0000 (17:40 +0000)
openbox/action.c
openbox/action.h

index a395af2d19c03ca5d41f095e4a8139e8d8497ac9..f780ce884b8fa2629ec768e202faae7f1c244e66 100644 (file)
 #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)
index 684887317960934688967bf2cd382b436030f8a0..c88ad85f7156bb7dec2c6ffc655b5cd8ae51f695 100644 (file)
@@ -169,7 +169,7 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                        ObUserAction uact);
 void action_free(ObAction *a);
 
-/*! Executes an action.
+/*! Executes a list of actions.
   @param c The client associated with the action. Can be NULL.
   @param state The keyboard modifiers state at the time the user action occured
   @param button The mouse button used to execute the action.
@@ -180,21 +180,21 @@ void action_free(ObAction *a);
   @param done If the action is completing an interactive action. This only
          affects interactive actions, but should generally always be FALSE.
 */
-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);
 
 #define action_run_mouse(a, c, s, b, x, y) \
-    action_run_full(a, c, s, b, x, y, FALSE, FALSE)
+    action_run_list(a, c, s, b, x, y, FALSE, FALSE)
 
 #define action_run_interactive(a, c, s, n, d) \
-    action_run_full(a, c, s, 0, -1, -1, n, d)
+    action_run_list(a, c, s, 0, -1, -1, n, d)
 
 #define action_run_key(a, c, s, x, y) \
-    action_run_full(a, c, s, 0, x, y, FALSE,FALSE)
+    action_run_list(a, c, s, 0, x, y, FALSE,FALSE)
 
 #define action_run(a, c, s) \
-    action_run_full(a, c, s, 0, -1, -1, FALSE,FALSE)
+    action_run_list(a, c, s, 0, -1, -1, FALSE,FALSE)
 
 /* Execute */
 void action_execute(union ActionData *data);
This page took 0.026414 seconds and 4 git commands to generate.