]> Dogcows Code - chaz/openbox/blobdiff - openbox/action.c
consistant glib type usage
[chaz/openbox] / openbox / action.c
index 767f8c115d213e1c25f85c5024b0dd0f8ee40eeb..483ac8dba349e3504681af6b5c2e0e995bf112cd 100644 (file)
@@ -234,7 +234,7 @@ void setup_action_send_to_desktop_down(ObAction **a, ObUserAction uact)
 
 void setup_action_desktop(ObAction **a, ObUserAction uact)
 {
-    (*a)->data.desktop.inter.any.interactive = TRUE;
+    (*a)->data.desktop.inter.any.interactive = FALSE;
 }
 
 void setup_action_desktop_prev(ObAction **a, ObUserAction uact)
@@ -798,11 +798,18 @@ ActionString actionstrings[] =
     }
 };
 
+/* only key bindings can be interactive. thus saith the xor.
+   because of how the mouse is grabbed, mouse events dont even get
+   read during interactive events, so no dice! >:) */
+#define INTERACTIVE_LIMIT(a, uact) \
+    if (uact != OB_USER_ACTION_KEYBOARD_KEY) \
+        a->data.any.interactive = FALSE;
+
 ObAction *action_from_string(const gchar *name, ObUserAction uact)
 {
     ObAction *a = NULL;
     gboolean exist = FALSE;
-    int i;
+    gint i;
 
     for (i = 0; actionstrings[i].name; i++)
         if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
@@ -810,11 +817,7 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact)
             a = action_new(actionstrings[i].func);
             if (actionstrings[i].setup)
                 actionstrings[i].setup(&a, uact);
-            /* only key bindings can be interactive. thus saith the xor.
-             because of how the mouse is grabbed, mouse events dont even get
-             read during interactive events, so no dice! >:) */
-            if (uact != OB_USER_ACTION_KEYBOARD_KEY)
-                a->data.any.interactive = FALSE;
+            INTERACTIVE_LIMIT(a, uact);
             break;
         }
     if (!exist)
@@ -828,7 +831,7 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact)
 ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                        ObUserAction uact)
 {
-    char *actname;
+    gchar *actname;
     ObAction *act = NULL;
     xmlNodePtr n;
 
@@ -888,6 +891,7 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                 if ((n = parse_find_node("dialog", node->xmlChildrenNode)))
                     act->data.cycle.dialog = parse_bool(doc, n);
             }
+            INTERACTIVE_LIMIT(act, uact);
         }
         g_free(actname);
     }
@@ -942,10 +946,13 @@ 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;
 
-            ob_main_loop_queue_action(ob_main_loop, a);
+                /* interactive actions are not queued */
+                a->func(&a->data);
+            } else
+                ob_main_loop_queue_action(ob_main_loop, a);
         }
     }
 }
@@ -966,7 +973,7 @@ void action_run_string(const gchar *name, struct _ObClient *c)
 void action_execute(union ActionData *data)
 {
     GError *e = NULL;
-    char *cmd;
+    gchar *cmd;
     if (data->execute.path) {
         cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
         if (cmd) {
@@ -988,6 +995,10 @@ void action_activate(union ActionData *data)
 
 void action_focus(union ActionData *data)
 {
+    /* if using focus_delay, stop the timer now so that focus doesn't go moving
+       on us */
+    event_halt_focus_delay();
+
     client_focus(data->client.any.c);
 }
 
@@ -1054,6 +1065,8 @@ void action_lower(union ActionData *data)
     client_action_start(data);
     stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
     client_action_end(data);
+
+    focus_order_to_bottom(data->client.any.c);
 }
 
 void action_close(union ActionData *data)
@@ -1294,18 +1307,27 @@ void action_toggle_decorations(union ActionData *data)
     client_action_end(data);
 }
 
-static guint32 pick_corner(int x, int y, int cx, int cy, int cw, int ch)
+static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch)
 {
-    if (x - cx > cw / 2) {
-        if (y - cy > ch / 2)
+    if ((cw / 3 < 1) || (x - cx > cw / 3 * 2)) {
+        if ((ch / 3 < 1) || (y - cy > ch / 3 * 2))
             return prop_atoms.net_wm_moveresize_size_bottomright;
-        else
+        else if (y - cy < ch / 3)
             return prop_atoms.net_wm_moveresize_size_topright;
+        else
+            return prop_atoms.net_wm_moveresize_size_right;
+    } else if (x - cx < cw / 3) {
+        if (y - cy > ch / 3 * 2)
+            return prop_atoms.net_wm_moveresize_size_bottomleft;
+        else if (y - cy < ch / 3)
+            return prop_atoms.net_wm_moveresize_size_topleft;
+        else
+            return prop_atoms.net_wm_moveresize_size_left;
     } else {
         if (y - cy > ch / 2)
-            return prop_atoms.net_wm_moveresize_size_bottomleft;
+            return prop_atoms.net_wm_moveresize_size_bottom;
         else
-            return prop_atoms.net_wm_moveresize_size_topleft;
+            return prop_atoms.net_wm_moveresize_size_top;
     }
 }
 
@@ -1363,6 +1385,10 @@ void action_showmenu(union ActionData *data)
 
 void action_cycle_windows(union ActionData *data)
 {
+    /* if using focus_delay, stop the timer now so that focus doesn't go moving
+       on us */
+    event_halt_focus_delay();
+
     focus_cycle(data->cycle.forward, data->cycle.linear,
                 data->cycle.dialog,
                 data->cycle.inter.final, data->cycle.inter.cancel);
@@ -1370,6 +1396,10 @@ void action_cycle_windows(union ActionData *data)
 
 void action_directional_focus(union ActionData *data)
 {
+    /* if using focus_delay, stop the timer now so that focus doesn't go moving
+       on us */
+    event_halt_focus_delay();
+
     focus_directional_cycle(data->interdiraction.direction,
                             data->interdiraction.dialog,
                             data->interdiraction.inter.final,
@@ -1378,7 +1408,7 @@ void action_directional_focus(union ActionData *data)
 
 void action_movetoedge(union ActionData *data)
 {
-    int x, y;
+    gint x, y;
     ObClient *c = data->diraction.any.c;
 
     x = c->frame->area.x;
@@ -1410,7 +1440,7 @@ void action_movetoedge(union ActionData *data)
 
 void action_growtoedge(union ActionData *data)
 {
-    int x, y, width, height, dest;
+    gint x, y, width, height, dest;
     ObClient *c = data->diraction.any.c;
     Rect *a;
 
This page took 0.028786 seconds and 4 git commands to generate.