X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Faction.c;h=1ba798fec77f2dad55e83858bec387dcc419a59f;hb=141c249b8cd3b94a722acc8c0225b3cbf83e5042;hp=4187c26243d8f1ceb87ec7ff8119058c0b34335f;hpb=20f4d7fd44a268c1f461495f8c4c8f269aa0f292;p=chaz%2Fopenbox diff --git a/openbox/action.c b/openbox/action.c index 4187c262..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 @@ -41,7 +42,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 +50,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 +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; } @@ -1013,7 +1020,7 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, } void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, - guint state, gint button, gint x, gint y, Time time, + guint state, guint button, gint x, gint y, Time time, gboolean cancel, gboolean done) { GSList *it; @@ -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,29 +1106,30 @@ 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) { - 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, - /* launch it on the current - desktop */ - screen_desktop, - 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", + g_message(_("Failed to execute '%s': %s"), cmd, e->message); g_error_free(e); sn_spawn_cancel(); } - g_strfreev(env); + unsetenv("DESKTOP_STARTUP_ID"); g_free(program); g_strfreev(argv); } else { @@ -1129,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); } @@ -1137,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); } } } @@ -1158,16 +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(); - 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(); } } @@ -1621,16 +1636,8 @@ void action_exit(union ActionData *data) void action_showmenu(union ActionData *data) { if (data->showmenu.name) { - gint x, y; - ObClient *c = data->showmenu.any.c; - if (data->any.button == -1 && c) { - x = c->frame->area.x + c->frame->size.left; - y = c->frame->area.y + c->frame->size.top; - } else { - x = data->any.x; - y = data->any.y; - } - menu_show(data->showmenu.name, x, y, c); + menu_show(data->showmenu.name, data->any.x, data->any.y, + data->showmenu.any.c); } }