]> Dogcows Code - chaz/openbox/blobdiff - openbox/action.c
1) translate all of openbox's output
[chaz/openbox] / openbox / action.c
index 6d455f1f6d3a38a0e55e5eccede066ca37314aad..1ba798fec77f2dad55e83858bec387dcc419a59f 100644 (file)
@@ -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 <glib.h>
 
@@ -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;
 }
 
@@ -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,26 +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,
-                                               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 {
@@ -1126,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);
                 }
@@ -1134,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);
         }
     }
 }
@@ -1149,30 +1161,35 @@ 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();
     }
 }
 
 void action_unfocus (union ActionData *data)
 {
     if (data->client.any.c == focus_client)
-        focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING);
+        focus_fallback(FALSE);
 }
 
 void action_iconify(union ActionData *data)
@@ -1632,8 +1649,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 +1662,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)
This page took 0.02581 seconds and 4 git commands to generate.