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);
#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);
}