]> Dogcows Code - chaz/openbox/blobdiff - openbox/action.c
add copyright headers, adjust --version output to include copyright, and --help outpu...
[chaz/openbox] / openbox / action.c
index e0f411e0fa2a1b47ca1dc211c072f69a20224acc..a0be04de081625a2bbffed6b8cba67f48fcdfbb5 100644 (file)
@@ -1,3 +1,21 @@
+/* -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
+
+   action.c for the Openbox window manager
+   Copyright (c) 2003        Ben 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
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
 #include "debug.h"
 #include "client.h"
 #include "focus.h"
@@ -698,6 +716,9 @@ ObAction *action_from_string(char *name, ObUserAction uact)
             a = action_new(actionstrings[i].func, uact);
             if (actionstrings[i].setup)
                 actionstrings[i].setup(&a, uact);
+            /* only key bindings can be interactive. thus saith the xor. */
+            if (uact != OB_USER_ACTION_KEYBOARD_KEY)
+                a->data.any.interactive = FALSE;
             break;
         }
     if (!exist)
@@ -720,7 +741,7 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             if (act->func == action_execute || act->func == action_restart) {
                 if ((n = parse_find_node("execute", node->xmlChildrenNode))) {
                     gchar *s = parse_string(doc, n);
-                    act->data.execute.path = ob_expand_tilde(s);
+                    act->data.execute.path = parse_expand_tilde(s);
                     g_free(s);
                 }
             } else if (act->func == action_showmenu) {
@@ -764,7 +785,6 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 }
 
 void action_run_full(ObAction *a, struct _ObClient *c,
-                     ObFrameContext context,
                      guint state, guint button, gint x, gint y,
                      gboolean cancel, gboolean done)
 {
@@ -781,7 +801,7 @@ void action_run_full(ObAction *a, struct _ObClient *c,
         a->data.inter.cancel = cancel;
         a->data.inter.final = done;
         if (!(cancel || done))
-            keyboard_interactive_grab(state, c, context, a);
+            keyboard_interactive_grab(state, c, a);
     }
 
     a->func(&a->data);
@@ -798,6 +818,7 @@ void action_execute(union ActionData *data)
                 g_warning("failed to execute '%s': %s",
                           cmd, e->message);
             }
+            g_free(cmd);
         } else {
             g_warning("failed to convert '%s' from utf8", data->execute.path);
         }
@@ -866,9 +887,11 @@ void action_raise(union ActionData *data)
 void action_unshaderaise(union ActionData *data)
 {
     if (data->client.any.c) {
-        if (data->client.any.c->shaded)
+        if (data->client.any.c->shaded) {
+            grab_pointer(TRUE, OB_CURSOR_NONE);
             client_shade(data->client.any.c, FALSE);
-        else
+            grab_pointer(FALSE, OB_CURSOR_NONE);
+        } else
             stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
     }
 }
@@ -878,8 +901,11 @@ void action_shadelower(union ActionData *data)
     if (data->client.any.c) {
         if (data->client.any.c->shaded)
             stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
-        else
+        else {
+            grab_pointer(TRUE, OB_CURSOR_NONE);
             client_shade(data->client.any.c, TRUE);
+            grab_pointer(FALSE, OB_CURSOR_NONE);
+        }
     }
 }
 
@@ -903,20 +929,29 @@ void action_kill(union ActionData *data)
 
 void action_shade(union ActionData *data)
 {
-    if (data->client.any.c)
+    if (data->client.any.c) { 
+        grab_pointer(TRUE, OB_CURSOR_NONE);
         client_shade(data->client.any.c, TRUE);
+        grab_pointer(FALSE, OB_CURSOR_NONE);
+    }
 }
 
 void action_unshade(union ActionData *data)
 {
-    if (data->client.any.c)
+    if (data->client.any.c) {
+        grab_pointer(TRUE, OB_CURSOR_NONE);
         client_shade(data->client.any.c, FALSE);
+        grab_pointer(FALSE, OB_CURSOR_NONE);
+    }
 }
 
 void action_toggle_shade(union ActionData *data)
 {
-    if (data->client.any.c)
+    if (data->client.any.c) {
+        grab_pointer(TRUE, OB_CURSOR_NONE);
         client_shade(data->client.any.c, !data->client.any.c->shaded);
+        grab_pointer(FALSE, OB_CURSOR_NONE);
+    }
 }
 
 void action_toggle_omnipresent(union ActionData *data)
@@ -1150,7 +1185,7 @@ void action_restart(union ActionData *data)
 
 void action_exit(union ActionData *data)
 {
-    ob_exit();
+    ob_exit(0);
 }
 
 void action_showmenu(union ActionData *data)
@@ -1215,11 +1250,12 @@ void action_growtoedge(union ActionData *data)
 {
     int x, y, width, height, dest;
     ObClient *c = data->diraction.any.c;
-    Rect *a = screen_area(c->desktop);
+    Rect *a;
 
     if (!c)
         return;
     
+    a = screen_area(c->desktop);
     x = c->frame->area.x;
     y = c->frame->area.y;
     width = c->frame->area.width;
This page took 0.024993 seconds and 4 git commands to generate.