Prevent focus stealing prevention when running apps with key bindings.
authorDana Jansens <danakj@orodu.net>
Fri, 25 Nov 2011 19:46:32 +0000 (14:46 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 25 Nov 2011 19:46:32 +0000 (14:46 -0500)
1. Let actions get the last say on event_last_user_timer (i.e. update it before
   calling their last function).
2. Reset it when executing something as we want to let it steal focus, unless
   user contiunes to use a window afterward.

openbox/action.c
openbox/actions/execute.c

index 8c07470..ae699e3 100644 (file)
@@ -308,15 +308,19 @@ gboolean action_run(ObAction *act, const ObActionListRun *data,
 
     if (run) {
         gboolean end;
+        const gboolean acted_on_focus = client_set_contains(set, focus_client);
+
+        if (!action_is_interactive(act) && acted_on_focus)
+            event_update_user_time();
 
         end = !act->def->run(set, data, act->options);
         g_assert(end || action_is_interactive(act));
 
-        if (end) {
-            if (action_is_interactive(act))
-                action_interactive_end_act();
-            else if (client_set_contains(set, focus_client))
+        if (action_is_interactive(act) && end) {
+            if (acted_on_focus)
                 event_update_user_time();
+
+            action_interactive_end_act();
         }
     }
 
index 3f02f2a..606dd9f 100644 (file)
@@ -208,6 +208,11 @@ static gboolean do_execute_each(ObClient *client,
     if (data->user_act != OB_USER_ACTION_MENU_SELECTION)
         event_cancel_all_key_grabs();
 
+    /* Negate any recent interaction with windows as we are executing
+       something, and want it to be focused if the user doesn't continue
+       interacting with a window. */
+    event_reset_user_time();
+
     e = NULL;
     if (!g_shell_parse_argv(cmd, NULL, &argv, &e)) {
         g_message("%s", e->message);