1 #include "openbox/actions.h"
2 #include "openbox/client.h"
4 /* These match the values for client_maximize */
15 static gpointer setup_func(xmlNodePtr node);
16 static gboolean run_func_on(ObActionsData *data, gpointer options);
17 static gboolean run_func_off(ObActionsData *data, gpointer options);
18 static gboolean run_func_toggle(ObActionsData *data, gpointer options);
20 void action_maximize_startup(void)
22 actions_register("Maximize", setup_func, g_free, run_func_on,
24 actions_register("Unmaximize", setup_func, g_free, run_func_off,
26 actions_register("ToggleMaximize", setup_func, g_free, run_func_toggle,
30 static gpointer setup_func(xmlNodePtr node)
35 o = g_new0(Options, 1);
38 if ((n = obt_parse_find_node(node, "direction"))) {
39 gchar *s = obt_parse_node_string(n);
40 if (!g_ascii_strcasecmp(s, "vertical") ||
41 !g_ascii_strcasecmp(s, "vert"))
43 else if (!g_ascii_strcasecmp(s, "horizontal") ||
44 !g_ascii_strcasecmp(s, "horz"))
52 /* Always return FALSE because its not interactive */
53 static gboolean run_func_on(ObActionsData *data, gpointer options)
57 actions_client_move(data, TRUE);
58 client_maximize(data->client, TRUE, o->dir);
59 actions_client_move(data, FALSE);
64 /* Always return FALSE because its not interactive */
65 static gboolean run_func_off(ObActionsData *data, gpointer options)
69 actions_client_move(data, TRUE);
70 client_maximize(data->client, FALSE, o->dir);
71 actions_client_move(data, FALSE);
76 /* Always return FALSE because its not interactive */
77 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
82 actions_client_move(data, TRUE);
83 toggle = ((o->dir == HORZ && !data->client->max_horz) ||
84 (o->dir == VERT && !data->client->max_vert) ||
86 !(data->client->max_horz && data->client->max_vert)));
87 client_maximize(data->client, toggle, o->dir);
88 actions_client_move(data, FALSE);