]> Dogcows Code - chaz/openbox/commitdiff
add horiz/vertical options to the maximize action
authorDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 14:47:10 +0000 (14:47 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 14:47:10 +0000 (14:47 +0000)
openbox/action.c
openbox/actions/maximize.c

index 7dd9da489ee985bb0800f43a2001b01c68ff3349..5b1fcd6c20e8b4cfa01d2fa6e3c160cacdad3899 100644 (file)
@@ -1127,42 +1127,6 @@ void action_resize_relative(union ActionData *data)
     client_action_end(data, FALSE);
 }
 
-void action_maximize_horz(union ActionData *data)
-{
-    client_action_start(data);
-    client_maximize(data->client.any.c, TRUE, 1);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_unmaximize_horz(union ActionData *data)
-{
-    client_action_start(data);
-    client_maximize(data->client.any.c, FALSE, 1);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_toggle_maximize_horz(union ActionData *data)
-{
-    client_action_start(data);
-    client_maximize(data->client.any.c,
-                    !data->client.any.c->max_horz, 1);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_maximize_vert(union ActionData *data)
-{
-    client_action_start(data);
-    client_maximize(data->client.any.c, TRUE, 2);
-    client_action_end(data, config_focus_under_mouse);
-}
-
-void action_unmaximize_vert(union ActionData *data)
-{
-    client_action_start(data);
-    client_maximize(data->client.any.c, FALSE, 2);
-    client_action_end(data, config_focus_under_mouse);
-}
-
 void action_toggle_maximize_vert(union ActionData *data)
 {
     client_action_start(data);
index 508c2d375d0c4a85651ecb424703ac9f849001f5..ebfb1e5c309c586ad3f54a690720f6ec26425efb 100644 (file)
@@ -1,24 +1,64 @@
 #include "openbox/actions.h"
 #include "openbox/client.h"
 
+typedef struct {
+    gboolean vertical;
+    gboolean horizontal;
+} 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_maximize_startup()
 {
     actions_register("Maximize",
-                     NULL, NULL,
+                     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->vertical = TRUE;
+    o->horizontal = TRUE;
+
+    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;
+}
+
+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);
-        client_maximize(data->client,
-                        !(data->client->max_horz || data->client->max_vert),
-                        0);
+
+        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)
+            client_maximize(data->client,
+                            !data->client->max_horz || !data->client->max_vert,
+                            0);
+
         actions_client_move(data, FALSE);
     }
 
This page took 0.027093 seconds and 4 git commands to generate.