From: Dana Jansens Date: Fri, 25 Nov 2011 19:46:32 +0000 (-0500) Subject: Prevent focus stealing prevention when running apps with key bindings. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=3b9fce92e0afab89a46080f525e4392bc4c01aa5;p=dana%2Fopenbox.git Prevent focus stealing prevention when running apps with key bindings. 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. --- diff --git a/openbox/action.c b/openbox/action.c index 8c07470f..ae699e39 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -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(); } } diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index 3f02f2a7..606dd9f0 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -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);