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);
19 /* 3.4-compatibility */
20 static gpointer setup_both_func(xmlNodePtr node);
21 static gpointer setup_horz_func(xmlNodePtr node);
22 static gpointer setup_vert_func(xmlNodePtr node);
24 void action_maximize_startup(void)
26 actions_register("Maximize", setup_func, g_free, run_func_on);
27 actions_register("Unmaximize", setup_func, g_free, run_func_off);
28 actions_register("ToggleMaximize", setup_func, g_free, run_func_toggle);
29 /* 3.4-compatibility */
30 actions_register("MaximizeFull", setup_both_func, g_free,
32 actions_register("UnmaximizeFull", setup_both_func, g_free,
34 actions_register("ToggleMaximizeFull", setup_both_func, g_free,
36 actions_register("MaximizeHorz", setup_horz_func, g_free,
38 actions_register("UnmaximizeHorz", setup_horz_func, g_free,
40 actions_register("ToggleMaximizeHorz", setup_horz_func, g_free,
42 actions_register("MaximizeVert", setup_vert_func, g_free,
44 actions_register("UnmaximizeVert", setup_vert_func, g_free,
46 actions_register("ToggleMaximizeVert", setup_vert_func, g_free,
50 static gpointer setup_func(xmlNodePtr node)
55 o = g_new0(Options, 1);
58 if ((n = obt_xml_find_node(node, "direction"))) {
59 gchar *s = obt_xml_node_string(n);
60 if (!g_ascii_strcasecmp(s, "vertical") ||
61 !g_ascii_strcasecmp(s, "vert"))
63 else if (!g_ascii_strcasecmp(s, "horizontal") ||
64 !g_ascii_strcasecmp(s, "horz"))
72 /* Always return FALSE because its not interactive */
73 static gboolean run_func_on(ObActionsData *data, gpointer options)
77 actions_client_move(data, TRUE);
78 client_maximize(data->client, TRUE, o->dir);
79 actions_client_move(data, FALSE);
84 /* Always return FALSE because its not interactive */
85 static gboolean run_func_off(ObActionsData *data, gpointer options)
89 actions_client_move(data, TRUE);
90 client_maximize(data->client, FALSE, o->dir);
91 actions_client_move(data, FALSE);
96 /* Always return FALSE because its not interactive */
97 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
102 actions_client_move(data, TRUE);
103 toggle = ((o->dir == HORZ && !data->client->max_horz) ||
104 (o->dir == VERT && !data->client->max_vert) ||
106 !(data->client->max_horz && data->client->max_vert)));
107 client_maximize(data->client, toggle, o->dir);
108 actions_client_move(data, FALSE);
113 /* 3.4-compatibility */
114 static gpointer setup_both_func(xmlNodePtr node)
116 Options *o = g_new0(Options, 1);
121 static gpointer setup_horz_func(xmlNodePtr node)
123 Options *o = g_new0(Options, 1);
128 static gpointer setup_vert_func(xmlNodePtr node)
130 Options *o = g_new0(Options, 1);