X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Faction.c;h=1ba798fec77f2dad55e83858bec387dcc419a59f;hb=141c249b8cd3b94a722acc8c0225b3cbf83e5042;hp=fc6f5a78292b2d9dffa8b1df44171079a271277d;hpb=ff43372da760c84e92ca7a7e9648d09fcfba2cf0;p=chaz%2Fopenbox diff --git a/openbox/action.c b/openbox/action.c index fc6f5a78..1ba798fe 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -2,7 +2,7 @@ action.c for the Openbox window manager Copyright (c) 2006 Mikael Magnusson - Copyright (c) 2003 Ben Jansens + Copyright (c) 2003-2007 Dana Jansens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ #include "config.h" #include "mainloop.h" #include "startupnotify.h" +#include "gettext.h" #include @@ -434,6 +435,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 +500,7 @@ ActionString actionstrings[] = { "focus", action_focus, - setup_client_action + setup_action_focus }, { "unfocus", @@ -907,10 +913,11 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact) break; } if (!exist) - g_warning("Invalid action '%s' requested. No such action exists.", + g_message(_("Invalid action '%s' requested. No such action exists."), name); if (!a) - g_warning("Invalid use of action '%s'. Action will be ignored.", name); + g_message(_("Invalid use of action '%s'. Action will be ignored."), + name); return a; } @@ -1042,7 +1049,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)) { @@ -1099,7 +1106,7 @@ void action_execute(union ActionData *data) cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL); if (cmd) { if (!g_shell_parse_argv (cmd, NULL, &argv, &e)) { - g_warning("failed to execute '%s': %s", + g_message(_("Failed to execute '%s': %s"), cmd, e->message); g_error_free(e); } else if (data->execute.startupnotify) { @@ -1117,7 +1124,7 @@ void action_execute(union ActionData *data) 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", + g_message(_("Failed to execute '%s': %s"), cmd, e->message); g_error_free(e); sn_spawn_cancel(); @@ -1130,7 +1137,7 @@ void action_execute(union ActionData *data) G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &e)) { - g_warning("failed to execute '%s': %s", + g_message(_("Failed to execute '%s': %s"), cmd, e->message); g_error_free(e); } @@ -1138,7 +1145,8 @@ void action_execute(union ActionData *data) } g_free(cmd); } else { - g_warning("failed to convert '%s' from utf8", data->execute.path); + g_message(_("Failed to convert the path '%s' from utf8"), + data->execute.path); } } } @@ -1159,15 +1167,22 @@ void action_activate(union ActionData *data) 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(); - client_focus(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(); } }