]> Dogcows Code - chaz/openbox/blobdiff - openbox/action.c
gracefully handle grabs failing when doing interactive actions
[chaz/openbox] / openbox / action.c
index 5f60019ecca45d2989fb07e16907170ef545212f..5f8b306fb1591b8448de8190795bb04e8949eb18 100644 (file)
@@ -891,8 +891,8 @@ 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);
         }
-        INTERACTIVE_LIMIT(act, uact);
         g_free(actname);
     }
     return act;
@@ -946,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);
         }
     }
 }
@@ -992,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);
 }
 
@@ -1302,16 +1309,25 @@ void action_toggle_decorations(union ActionData *data)
 
 static guint32 pick_corner(int x, int y, int cx, int cy, int cw, int 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;
     }
 }
 
@@ -1369,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);
@@ -1376,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,
This page took 0.028005 seconds and 4 git commands to generate.