]> Dogcows Code - chaz/openbox/commitdiff
add dockautohide action
authorDana Jansens <danakj@orodu.net>
Sat, 23 Jun 2007 14:44:58 +0000 (14:44 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 23 Jun 2007 14:44:58 +0000 (14:44 +0000)
Makefile.am
openbox/action.c
openbox/actions/all.c
openbox/actions/all.h
openbox/actions/dockautohide.c [new file with mode: 0644]

index c65101e676fda8b2368f9bd5dcaefef0c802357f..9a9f9d3f0c19de400c73b495f852da801253002f 100644 (file)
@@ -163,6 +163,7 @@ openbox_openbox_SOURCES = \
        openbox/actions/debug.c \
        openbox/actions/decorations.c \
        openbox/actions/desktop.c \
+       openbox/actions/dockautohide.c \
        openbox/actions/directionalcyclewindows.c \
        openbox/actions/directionaldesktop.c \
        openbox/actions/directionaltargetwindow.c \
index 8b2cfe857fe63efc03d9bd885b2f30aef40da253..3bf5433088f63f04fd24351677d93941e238ffd3 100644 (file)
 
 
 
-typedef struct
-{
-    const gchar *name;
-    void (*func)(union ActionData *);
-    void (*setup)(ObAction **, ObUserAction uact);
-} ActionString;
-
-static ObAction *action_new(void (*func)(union ActionData *data))
-{
-    ObAction *a = g_new0(ObAction, 1);
-    a->ref = 1;
-    a->func = func;
-
-    return a;
-}
-
-void action_ref(ObAction *a)
-{
-    ++a->ref;
-}
-
-void action_unref(ObAction *a)
-{
-    if (a == NULL) return;
-
-    if (--a->ref > 0) return;
-
-    /* deal with pointers */
-    if (a->func == action_execute || a->func == action_restart)
-        g_free(a->data.execute.path);
-    else if (a->func == action_debug)
-        g_free(a->data.debug.string);
-    else if (a->func == action_showmenu)
-        g_free(a->data.showmenu.name);
-
-    g_free(a);
-}
-
-ObAction* action_copy(const ObAction *src)
-{
-    ObAction *a = action_new(src->func);
-
-    a->data = src->data;
-
-    /* deal with pointers */
-    if (a->func == action_execute || a->func == action_restart)
-        a->data.execute.path = g_strdup(a->data.execute.path);
-    else if (a->func == action_debug)
-        a->data.debug.string = g_strdup(a->data.debug.string);
-    else if (a->func == action_showmenu)
-        a->data.showmenu.name = g_strdup(a->data.showmenu.name);
-
-    return a;
-}
-
-void setup_action_send_to_desktop_prev(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_WEST;
-    (*a)->data.sendtodir.linear = TRUE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_send_to_desktop_next(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_EAST;
-    (*a)->data.sendtodir.linear = TRUE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_send_to_desktop_left(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_WEST;
-    (*a)->data.sendtodir.linear = FALSE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_send_to_desktop_right(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_EAST;
-    (*a)->data.sendtodir.linear = FALSE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_send_to_desktop_up(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_NORTH;
-    (*a)->data.sendtodir.linear = FALSE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_send_to_desktop_down(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.sendtodir.inter.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.sendtodir.inter.any.interactive = TRUE;
-    (*a)->data.sendtodir.dir = OB_DIRECTION_SOUTH;
-    (*a)->data.sendtodir.linear = FALSE;
-    (*a)->data.sendtodir.wrap = TRUE;
-    (*a)->data.sendtodir.follow = TRUE;
-}
-
-void setup_action_desktop_prev(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_WEST;
-    (*a)->data.desktopdir.linear = TRUE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
-
-void setup_action_desktop_next(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_EAST;
-    (*a)->data.desktopdir.linear = TRUE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
-
-void setup_action_desktop_left(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_WEST;
-    (*a)->data.desktopdir.linear = FALSE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
-
-void setup_action_desktop_right(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_EAST;
-    (*a)->data.desktopdir.linear = FALSE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
-
-void setup_action_desktop_up(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_NORTH;
-    (*a)->data.desktopdir.linear = FALSE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
-
-void setup_action_desktop_down(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.desktopdir.inter.any.interactive = TRUE;
-    (*a)->data.desktopdir.dir = OB_DIRECTION_SOUTH;
-    (*a)->data.desktopdir.linear = FALSE;
-    (*a)->data.desktopdir.wrap = TRUE;
-}
 
 void setup_action_movefromedge_north(ObAction **a, ObUserAction uact)
 {
@@ -319,41 +157,6 @@ ActionString actionstrings[] =
         action_unshaderaise,
         setup_client_action
     },
-    {
-        "sendtodesktopnext",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_next
-    },
-    {
-        "sendtodesktopprevious",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_prev
-    },
-    {
-        "sendtodesktopright",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_right
-    },
-    {
-        "sendtodesktopleft",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_left
-    },
-    {
-        "sendtodesktopup",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_up
-    },
-    {
-        "sendtodesktopdown",
-        action_send_to_desktop_dir,
-        setup_action_send_to_desktop_down
-    },
-    {
-        "toggledockautohide",
-        action_toggle_dockautohide,
-        NULL
-    },
     {
         "sendtotoplayer",
         action_send_to_layer,
@@ -587,8 +390,6 @@ void action_toggle_layer(union ActionData *data)
 
 void action_toggle_dockautohide(union ActionData *data)
 {
-    config_dock_hide = !config_dock_hide;
-    dock_configure();
 }
 
 void action_remove_desktop(union ActionData *data)
index 4e35181710bd4060c9ced4e56fb475a6c6f073f9..ea81882b89d3c0311fd5b74f3001ad30272bcf9c 100644 (file)
@@ -36,4 +36,5 @@ void action_all_startup()
     action_directionaldesktop_startup();
     action_resizerelative_startup();
     action_addremovedesktop_startup();
+    action_dockautohide_startup();
 }
index 2919463bbd1a4681658ec2a66417272e43d32406..6c7b60d94eeec12b0ff0819bb99bad8860d07dbb 100644 (file)
@@ -37,5 +37,6 @@ void action_desktop_startup();
 void action_directionaldesktop_startup();
 void action_resizerelative_startup();
 void action_addremovedesktop_startup();
+void action_dockautohide_startup();
 
 #endif
diff --git a/openbox/actions/dockautohide.c b/openbox/actions/dockautohide.c
new file mode 100644 (file)
index 0000000..e7f6505
--- /dev/null
@@ -0,0 +1,22 @@
+#include "openbox/actions.h"
+#include "openbox/dock.h"
+#include "openbox/config.h"
+
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_dockautohide_startup()
+{
+    actions_register("DockAutoHide",
+                     NULL, NULL,
+                     run_func,
+                     NULL, NULL);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+    config_dock_hide = !config_dock_hide;
+    dock_configure();
+
+    return FALSE;
+}
This page took 0.031759 seconds and 4 git commands to generate.