]> Dogcows Code - chaz/openbox/commitdiff
add max horz/vert actions. add toggle/on/off ability to all the maximize actions.
authorDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 15:39:20 +0000 (15:39 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 15:39:20 +0000 (15:39 +0000)
add shade action.

Makefile.am
openbox/action.c
openbox/actions/all.c
openbox/actions/all.h
openbox/actions/maximize.c
openbox/actions/maximizehorizontal.c [new file with mode: 0644]
openbox/actions/maximizevertical.c [new file with mode: 0644]
openbox/actions/shade.c [new file with mode: 0644]

index 82cdfed3357d73659eb43c6c63230e7e2ac12617..a63af6c0b0f87d7dd72582b18a6edb2121509707 100644 (file)
@@ -167,6 +167,8 @@ openbox_openbox_SOURCES = \
        openbox/actions/iconify.c \
        openbox/actions/lower.c \
        openbox/actions/maximize.c \
+       openbox/actions/maximizehorizontal.c \
+       openbox/actions/maximizevertical.c \
        openbox/actions/move.c \
        openbox/actions/moverelative.c \
        openbox/actions/moveto.c \
@@ -174,6 +176,7 @@ openbox_openbox_SOURCES = \
        openbox/actions/raiselower.c \
        openbox/actions/reconfigure.c \
        openbox/actions/restart.c \
+       openbox/actions/shade.c \
        openbox/actions/showdesktop.c \
        openbox/actions/showmenu.c \
        openbox/actions/unfocus.c \
index dca4ede4b62646416abeb6a5d43f4c91b3b22765..1bc85db218732aca7a3592258e4c209de90172ab 100644 (file)
@@ -469,31 +469,11 @@ ActionString actionstrings[] =
         action_unshaderaise,
         setup_client_action
     },
-    {
-        "shade",
-        action_shade,
-        setup_client_action
-    },
-    {
-        "unshade",
-        action_unshade,
-        setup_client_action
-    },
-    {
-        "toggleshade",
-        action_toggle_shade,
-        setup_client_action
-    },
     {
         "toggleomnipresent",
         action_toggle_omnipresent,
         setup_client_action
     },
-    {
-        "moverelativehorz",
-        action_move_relative_horz,
-        setup_client_action
-    },
     {
         "resizerelativevert",
         action_resize_relative_vert,
@@ -950,27 +930,6 @@ void action_kill(union ActionData *data)
     client_kill(data->client.any.c);
 }
 
-void action_shade(union ActionData *data)
-{
-    client_action_start(data);
-    client_shade(data->client.any.c, TRUE);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_unshade(union ActionData *data)
-{
-    client_action_start(data);
-    client_shade(data->client.any.c, FALSE);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_toggle_shade(union ActionData *data)
-{
-    client_action_start(data);
-    client_shade(data->client.any.c, !data->client.any.c->shaded);
-    client_action_end(data, config_focus_under_mouse);
-}
-
 void action_toggle_omnipresent(union ActionData *data)
 { 
     client_set_desktop(data->client.any.c,
@@ -999,15 +958,6 @@ void action_resize_relative_vert(union ActionData *data)
     }
 }
 
-void action_move_relative(union ActionData *data)
-{
-    ObClient *c = data->relative.any.c;
-    client_action_start(data);
-    client_move(c, c->area.x + data->relative.deltax, c->area.y +
-                data->relative.deltay);
-    client_action_end(data, FALSE);
-}
-
 void action_resize_relative(union ActionData *data)
 {
     ObClient *c = data->relative.any.c;
index cbd9f137c99ffe2a5ec24e68cfbb16f42bb606d4..64587f466d480e553235654313c46fd04efeb256 100644 (file)
@@ -21,6 +21,9 @@ void action_all_startup()
     action_iconify_startup();
     action_fullscreen_startup();
     action_maximize_startup();
+    action_maximizehorizontal_startup();
+    action_maximizevertical_startup();
     action_moveto_startup();
     action_moverelative_startup();
+    action_shade_startup();
 }
index f026106eec93cca3fb18205b8c7ada4b94b68e51..bc25461fbcb08b2c535d125949d28aa8d3ebdf11 100644 (file)
@@ -22,7 +22,10 @@ void action_unfocus_startup();
 void action_iconify_startup();
 void action_fullscreen_startup();
 void action_maximize_startup();
+void action_maximizehorizontal_startup();
+void action_maximizevertical_startup();
 void action_moveto_startup();
 void action_moverelative_startup();
+void action_shade_startup();
 
 #endif
index ebfb1e5c309c586ad3f54a690720f6ec26425efb..cc2d44e253311ddf742b3eb0bb9552e561036137 100644 (file)
@@ -2,8 +2,8 @@
 #include "openbox/client.h"
 
 typedef struct {
-    gboolean vertical;
-    gboolean horizontal;
+    gboolean toggle;
+    gboolean on;
 } Options;
 
 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
@@ -25,13 +25,17 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     Options *o;
 
     o = g_new0(Options, 1);
-    o->vertical = TRUE;
-    o->horizontal = TRUE;
+    o->toggle = TRUE;
+
+    if ((n = parse_find_node("maximize", node))) {
+        gchar *s = parse_string(doc, n);
+        if (g_ascii_strcasecmp(s, "toggle")) {
+            o->toggle = FALSE;
+            o->on = parse_bool(doc, n);
+        }
+        g_free(s);
+    }
 
-    if ((n = parse_find_node("vertical", node)))
-        o->vertical = parse_bool(doc, n);
-    if ((n = parse_find_node("horizontal", node)))
-        o->horizontal = parse_bool(doc, n);
     return o;
 }
 
@@ -50,14 +54,12 @@ static gboolean run_func(ObActionsData *data, gpointer options)
     if (data->client) {
         actions_client_move(data, TRUE);
 
-        if (o->horizontal && !o->vertical)
-            client_maximize(data->client, !data->client->max_horz, 1);
-        else if (!o->horizontal && o->vertical)
-            client_maximize(data->client, !data->client->max_vert, 2);
-        else if (o->horizontal && o->vertical)
+        if (o->toggle)
             client_maximize(data->client,
                             !data->client->max_horz || !data->client->max_vert,
                             0);
+        else
+            client_maximize(data->client, o->on, 0);
 
         actions_client_move(data, FALSE);
     }
diff --git a/openbox/actions/maximizehorizontal.c b/openbox/actions/maximizehorizontal.c
new file mode 100644 (file)
index 0000000..aaaaa51
--- /dev/null
@@ -0,0 +1,66 @@
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+typedef struct {
+    gboolean toggle;
+    gboolean on;
+} 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_maximizehorizontal_startup()
+{
+    actions_register("MaximizeHorizontal",
+                     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->toggle = TRUE;
+
+    if ((n = parse_find_node("maximize", node))) {
+        gchar *s = parse_string(doc, n);
+        if (g_ascii_strcasecmp(s, "toggle")) {
+            o->toggle = FALSE;
+            o->on = parse_bool(doc, n);
+        }
+        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;
+
+    if (data->client) {
+        actions_client_move(data, TRUE);
+
+        if (o->toggle)
+            client_maximize(data->client, !data->client->max_horz, 1);
+        else
+            client_maximize(data->client, o->on, 1);
+
+        actions_client_move(data, FALSE);
+    }
+
+    return FALSE;
+}
diff --git a/openbox/actions/maximizevertical.c b/openbox/actions/maximizevertical.c
new file mode 100644 (file)
index 0000000..73e1b75
--- /dev/null
@@ -0,0 +1,66 @@
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+typedef struct {
+    gboolean toggle;
+    gboolean on;
+} 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_maximizevertical_startup()
+{
+    actions_register("MaximizeVertical",
+                     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->toggle = TRUE;
+
+    if ((n = parse_find_node("maximize", node))) {
+        gchar *s = parse_string(doc, n);
+        if (g_ascii_strcasecmp(s, "toggle")) {
+            o->toggle = FALSE;
+            o->on = parse_bool(doc, n);
+        }
+        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;
+
+    if (data->client) {
+        actions_client_move(data, TRUE);
+
+        if (o->toggle)
+            client_maximize(data->client, !data->client->max_vert, 2);
+        else
+            client_maximize(data->client, o->on, 2);
+
+        actions_client_move(data, FALSE);
+    }
+
+    return FALSE;
+}
diff --git a/openbox/actions/shade.c b/openbox/actions/shade.c
new file mode 100644 (file)
index 0000000..f5c111b
--- /dev/null
@@ -0,0 +1,64 @@
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+typedef struct {
+    gboolean toggle;
+    gboolean on;
+} 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_shade_startup()
+{
+    actions_register("Shade",
+                     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->toggle = TRUE;
+
+    if ((n = parse_find_node("shade", node))) {
+        gchar *s = parse_string(doc, n);
+        if (g_ascii_strcasecmp(s, "toggle")) {
+            o->toggle = FALSE;
+            o->on = parse_bool(doc, n);
+        }
+        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;
+
+    if (data->client) {
+        actions_client_move(data, TRUE);
+        if (o->toggle)
+            client_shade(data->client, !data->client->shaded);
+        else
+            client_shade(data->client, o->on);
+        actions_client_move(data, FALSE);
+    }
+
+    return FALSE;
+}
This page took 0.037625 seconds and 4 git commands to generate.