]> Dogcows Code - chaz/openbox/commitdiff
add directionaldesktop action
authorDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 19:10:00 +0000 (19:10 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 19:10:00 +0000 (19:10 +0000)
Makefile.am
openbox/action.c
openbox/actions/all.c
openbox/actions/all.h
openbox/actions/desktop.c
openbox/actions/directionalcyclewindows.c
openbox/actions/directionaldesktop.c [new file with mode: 0644]
openbox/actions/directionaltargetwindow.c

index 5134c9c8185299615e2aa7d25a755f615b257633..63c3f843af1d5eacf38cd25f7a0123a051628be9 100644 (file)
@@ -163,6 +163,7 @@ openbox_openbox_SOURCES = \
        openbox/actions/decorations.c \
        openbox/actions/desktop.c \
        openbox/actions/directionalcyclewindows.c \
+       openbox/actions/directionaldesktop.c \
        openbox/actions/directionaltargetwindow.c \
        openbox/actions/execute.c \
        openbox/actions/exit.c \
index 58a0e61ffc7a97efd2659a4c79300230c7cd4aee..be54a0066823c741291977046cc9bac982213f31 100644 (file)
@@ -390,36 +390,6 @@ ActionString actionstrings[] =
         action_send_to_desktop_dir,
         setup_action_send_to_desktop_down
     },
-    {
-        "desktopnext",
-        action_desktop_dir,
-        setup_action_desktop_next
-    },
-    {
-        "desktopprevious",
-        action_desktop_dir,
-        setup_action_desktop_prev
-    },
-    {
-        "desktopright",
-        action_desktop_dir,
-        setup_action_desktop_right
-    },
-    {
-        "desktopleft",
-        action_desktop_dir,
-        setup_action_desktop_left
-    },
-    {
-        "desktopup",
-        action_desktop_dir,
-        setup_action_desktop_up
-    },
-    {
-        "desktopdown",
-        action_desktop_dir,
-        setup_action_desktop_down
-    },
     {
         "toggledockautohide",
         action_toggle_dockautohide,
@@ -607,12 +577,6 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                 if (act->data.sendto.desk > 0) act->data.sendto.desk--;
                 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
                     act->data.sendto.follow = parse_bool(doc, n);
-            } else if (act->func == action_desktop_dir) {
-                if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
-                    act->data.desktopdir.wrap = parse_bool(doc, n); 
-                if ((n = parse_find_node("dialog", node->xmlChildrenNode)))
-                    act->data.desktopdir.inter.any.interactive =
-                        parse_bool(doc, n);
             } else if (act->func == action_send_to_desktop_dir) {
                 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
                     act->data.sendtodir.wrap = parse_bool(doc, n);
index 3fb4f816e0032ff58d4e29f759d29a391e7424d8..cb3f98710092d0e7a6fc249b04c85bced9214bea 100644 (file)
@@ -33,4 +33,5 @@ void action_all_startup()
     action_resize_startup();
     action_decorations_startup();
     action_desktop_startup();
+    action_directionaldesktop_startup();
 }
index 290c8f1462b258295a25cca278b5db1e2a3380cd..ea0a3d2574319888c44d325b8d4de5e703e6cc79 100644 (file)
@@ -34,5 +34,6 @@ void action_directionaltargetwindow_startup();
 void action_resize_startup();
 void action_decorations_startup();
 void action_desktop_startup();
+void action_directionaldesktop_startup();
 
 #endif
index 7461d8495e4a282c5dfc272df82627c36e787854..2d2014e40024950fab13ce092dc98563fd6e9b4e 100644 (file)
@@ -12,7 +12,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);
 
 void action_desktop_startup()
 {
-    actions_register("desktop",
+    actions_register("Desktop",
                      setup_func,
                      free_func,
                      run_func,
index 6554eeff5bffca4bb1461cf83b3ef19586d03286..65cc05b582153f81a49de096cc1aa8bca9b85788 100644 (file)
@@ -50,17 +50,21 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
         o->desktop_windows = parse_bool(doc, n);
     if ((n = parse_find_node("direction", node))) {
         gchar *s = parse_string(doc, n);
-        if (!g_ascii_strcasecmp(s, "north"))
+        if (!g_ascii_strcasecmp(s, "north") ||
+            !g_ascii_strcasecmp(s, "up"))
             o->direction = OB_DIRECTION_NORTH;
         else if (!g_ascii_strcasecmp(s, "northwest"))
             o->direction = OB_DIRECTION_NORTHWEST;
         else if (!g_ascii_strcasecmp(s, "northeast"))
             o->direction = OB_DIRECTION_NORTHEAST;
-        else if (!g_ascii_strcasecmp(s, "west"))
+        else if (!g_ascii_strcasecmp(s, "west") ||
+                 !g_ascii_strcasecmp(s, "left"))
             o->direction = OB_DIRECTION_WEST;
-        else if (!g_ascii_strcasecmp(s, "east"))
+        else if (!g_ascii_strcasecmp(s, "east") ||
+                 !g_ascii_strcasecmp(s, "right"))
             o->direction = OB_DIRECTION_EAST;
-        else if (!g_ascii_strcasecmp(s, "south"))
+        else if (!g_ascii_strcasecmp(s, "south") ||
+                 !g_ascii_strcasecmp(s, "down"))
             o->direction = OB_DIRECTION_NORTH;
         else if (!g_ascii_strcasecmp(s, "southwest"))
             o->direction = OB_DIRECTION_NORTHWEST;
diff --git a/openbox/actions/directionaldesktop.c b/openbox/actions/directionaldesktop.c
new file mode 100644 (file)
index 0000000..c052e6e
--- /dev/null
@@ -0,0 +1,84 @@
+#include "openbox/actions.h"
+#include "openbox/screen.h"
+#include <glib.h>
+
+typedef struct {
+    gboolean linear;
+    gboolean wrap;
+    ObDirection dir;
+} Options;
+
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
+static void     free_func(gpointer options);
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_directionaldesktop_startup()
+{
+    actions_register("DirectionalDesktop",
+                     setup_func,
+                     free_func,
+                     run_func,
+                     NULL, NULL);
+}
+
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
+{
+    xmlNodePtr n;
+    Options *o;
+
+    o = g_new0(Options, 1);
+    o->wrap = TRUE;
+    o->dir = OB_DIRECTION_EAST;
+
+    if ((n = parse_find_node("wrap", node)))
+        o->wrap = parse_bool(doc, n);
+    if ((n = parse_find_node("direction", node))) {
+        gchar *s = parse_string(doc, n);
+        if (!g_ascii_strcasecmp(s, "next")) {
+            o->linear = TRUE;
+            o->dir = OB_DIRECTION_EAST;
+        }
+        else if (!g_ascii_strcasecmp(s, "previous")) {
+            o->linear = TRUE;
+            o->dir = OB_DIRECTION_WEST;
+        }
+        else if (!g_ascii_strcasecmp(s, "north") ||
+                 !g_ascii_strcasecmp(s, "up"))
+            o->dir = OB_DIRECTION_NORTH;
+        else if (!g_ascii_strcasecmp(s, "south") ||
+                 !g_ascii_strcasecmp(s, "down"))
+            o->dir = OB_DIRECTION_SOUTH;
+        else if (!g_ascii_strcasecmp(s, "west") ||
+                 !g_ascii_strcasecmp(s, "left"))
+            o->dir = OB_DIRECTION_WEST;
+        else if (!g_ascii_strcasecmp(s, "east") ||
+                 !g_ascii_strcasecmp(s, "right"))
+            o->dir = OB_DIRECTION_EAST;
+        g_free(s);
+    }
+
+    return o;
+}
+
+static void free_func(gpointer options)
+{
+    Options *o = options;
+
+    g_free(o);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+    Options *o = options;
+    guint d;
+
+    d = screen_cycle_desktop(o->dir,
+                             o->wrap,
+                             o->linear,
+                             FALSE, TRUE, FALSE);
+    if (d != screen_desktop)
+        screen_set_desktop(d, TRUE);
+
+    return FALSE;
+}
index 93d33fbee636e4d50f3ada7c4bd823ba497dc06e..ac6d8b727d8910239a708b2967606b92dd388031 100644 (file)
@@ -42,17 +42,21 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
         o->desktop_windows = parse_bool(doc, n);
     if ((n = parse_find_node("direction", node))) {
         gchar *s = parse_string(doc, n);
-        if (!g_ascii_strcasecmp(s, "north"))
+        if (!g_ascii_strcasecmp(s, "north") ||
+            !g_ascii_strcasecmp(s, "up"))
             o->direction = OB_DIRECTION_NORTH;
         else if (!g_ascii_strcasecmp(s, "northwest"))
             o->direction = OB_DIRECTION_NORTHWEST;
         else if (!g_ascii_strcasecmp(s, "northeast"))
             o->direction = OB_DIRECTION_NORTHEAST;
-        else if (!g_ascii_strcasecmp(s, "west"))
+        else if (!g_ascii_strcasecmp(s, "west") ||
+                 !g_ascii_strcasecmp(s, "left"))
             o->direction = OB_DIRECTION_WEST;
-        else if (!g_ascii_strcasecmp(s, "east"))
+        else if (!g_ascii_strcasecmp(s, "east") ||
+                 !g_ascii_strcasecmp(s, "right"))
             o->direction = OB_DIRECTION_EAST;
-        else if (!g_ascii_strcasecmp(s, "south"))
+        else if (!g_ascii_strcasecmp(s, "south") ||
+                 !g_ascii_strcasecmp(s, "down"))
             o->direction = OB_DIRECTION_NORTH;
         else if (!g_ascii_strcasecmp(s, "southwest"))
             o->direction = OB_DIRECTION_NORTHWEST;
This page took 0.043442 seconds and 4 git commands to generate.