X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Faction.c;h=db49f56cd8f09e01727f25142caaa57f043daaff;hb=66c350763fa85cfda0b6561ace9c032d3aa03b71;hp=73524ae4e0019af4cecabf7a0a5e73d3cb42fdf1;hpb=adc5675823de8e3bbe94a1419b04103c6f845dad;p=chaz%2Fopenbox diff --git a/openbox/action.c b/openbox/action.c index 73524ae4..db49f56c 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -41,7 +41,7 @@ inline void client_action_start(union ActionData *data) { if (config_focus_follow) if (data->any.context != OB_FRAME_CONTEXT_CLIENT && !data->any.button) - grab_pointer(TRUE, OB_CURSOR_NONE); + grab_pointer(TRUE, FALSE, OB_CURSOR_NONE); } inline void client_action_end(union ActionData *data) @@ -49,7 +49,7 @@ inline void client_action_end(union ActionData *data) if (config_focus_follow) if (data->any.context != OB_FRAME_CONTEXT_CLIENT) { if (!data->any.button) { - grab_pointer(FALSE, OB_CURSOR_NONE); + grab_pointer(FALSE, FALSE, OB_CURSOR_NONE); } else { ObClient *c; @@ -434,6 +434,11 @@ void setup_action_showmenu(ObAction **a, ObUserAction uact) } } +void setup_action_focus(ObAction **a, ObUserAction uact) +{ + (*a)->data.any.client_action = OB_CLIENT_ACTION_OPTIONAL; +} + void setup_client_action(ObAction **a, ObUserAction uact) { (*a)->data.any.client_action = OB_CLIENT_ACTION_ALWAYS; @@ -494,7 +499,7 @@ ActionString actionstrings[] = { "focus", action_focus, - setup_client_action + setup_action_focus }, { "unfocus", @@ -1042,7 +1047,7 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, 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_curtime); + grab_keyboard(FALSE); } for (it = acts; it; it = g_slist_next(it)) { @@ -1103,14 +1108,18 @@ void action_execute(union ActionData *data) cmd, e->message); g_error_free(e); } else if (data->execute.startupnotify) { - gchar **env, *program; + gchar *program; program = g_path_get_basename(argv[0]); - env = sn_get_spawn_environment(program, - data->execute.name, - data->execute.icon_name, - data->execute.any.time); - if (!g_spawn_async(NULL, argv, env, G_SPAWN_SEARCH_PATH | + /* sets up the environment */ + sn_setup_spawn_environment(program, + data->execute.name, + data->execute.icon_name, + /* launch it on the current + desktop */ + screen_desktop, + data->execute.any.time); + if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &e)) { g_warning("failed to execute '%s': %s", @@ -1118,7 +1127,7 @@ void action_execute(union ActionData *data) g_error_free(e); sn_spawn_cancel(); } - g_strfreev(env); + unsetenv("DESKTOP_STARTUP_ID"); g_free(program); g_strfreev(argv); } else { @@ -1149,23 +1158,28 @@ void action_activate(union ActionData *data) moving on us */ event_halt_focus_delay(); - client_activate(data->activate.any.c, data->activate.here, TRUE, - data->activate.any.time); + client_activate(data->activate.any.c, data->activate.here, TRUE); } } void action_focus(union ActionData *data) { - /* similar to the openbox dock for dockapps, don't let user actions give - focus to 3rd-party docks (panels) either (unless they ask for it - themselves). */ - if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { - /* if using focus_delay, stop the timer now so that focus doesn't go - moving on us */ - event_halt_focus_delay(); + if (data->client.any.c) { + /* similar to the openbox dock for dockapps, don't let user actions + give focus to 3rd-party docks (panels) either (unless they ask for + it themselves). */ + if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { + /* if using focus_delay, stop the timer now so that focus doesn't + go moving on us */ + event_halt_focus_delay(); - if (client_validate(data->client.any.c)) client_focus(data->client.any.c); + } + } else { + /* focus action on something other than a client, make keybindings + work for this openbox instance, but don't focus any specific client + */ + focus_nothing(); } } @@ -1632,8 +1646,7 @@ void action_cycle_windows(union ActionData *data) focus_cycle(data->cycle.forward, data->cycle.linear, data->any.interactive, data->cycle.dialog, - data->cycle.inter.final, data->cycle.inter.cancel, - data->cycle.inter.any.time); + data->cycle.inter.final, data->cycle.inter.cancel); } void action_directional_focus(union ActionData *data) @@ -1646,8 +1659,7 @@ void action_directional_focus(union ActionData *data) data->any.interactive, data->interdiraction.dialog, data->interdiraction.inter.final, - data->interdiraction.inter.cancel, - data->interdiraction.inter.any.time); + data->interdiraction.inter.cancel); } void action_movetoedge(union ActionData *data)