1 #include "openbox/actions.h"
2 #include "openbox/client.h"
4 /* These match the values for client_maximize */
15 static gpointer setup_both_func(ObParseInst *i, xmlDocPtr doc,
17 static gpointer setup_horz_func(ObParseInst *i, xmlDocPtr doc,
19 static gpointer setup_vert_func(ObParseInst *i,
20 xmlDocPtr doc, xmlNodePtr node);
21 static gboolean run_func_on(ObActionsData *data, gpointer options);
22 static gboolean run_func_off(ObActionsData *data, gpointer options);
23 static gboolean run_func_toggle(ObActionsData *data, gpointer options);
25 void action_maximize_startup(void)
27 actions_register("MaximizeFull", setup_both_func, g_free,
28 run_func_on, NULL, NULL);
29 actions_register("UnmaximizeFull", setup_both_func, g_free,
30 run_func_off, NULL, NULL);
31 actions_register("ToggleMaximizeFull", setup_both_func, g_free,
32 run_func_toggle, NULL, NULL);
33 actions_register("MaximizeHorz", setup_horz_func, g_free,
34 run_func_on, NULL, NULL);
35 actions_register("UnmaximizeHorz", setup_horz_func, g_free,
36 run_func_off, NULL, NULL);
37 actions_register("ToggleMaximizeHorz", setup_horz_func, g_free,
38 run_func_toggle, NULL, NULL);
39 actions_register("MaximizeVert", setup_vert_func, g_free,
40 run_func_on, NULL, NULL);
41 actions_register("UnmaximizeVert", setup_vert_func, g_free,
42 run_func_off, NULL, NULL);
43 actions_register("ToggleMaximizeVert", setup_vert_func, g_free,
44 run_func_toggle, NULL, NULL);
47 static gpointer setup_both_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
49 Options *o = g_new0(Options, 1);
54 static gpointer setup_horz_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
56 Options *o = g_new0(Options, 1);
61 static gpointer setup_vert_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
63 Options *o = g_new0(Options, 1);
68 /* Always return FALSE because its not interactive */
69 static gboolean run_func_on(ObActionsData *data, gpointer options)
73 actions_client_move(data, TRUE);
74 client_maximize(data->client, TRUE, o->dir);
75 actions_client_move(data, FALSE);
80 /* Always return FALSE because its not interactive */
81 static gboolean run_func_off(ObActionsData *data, gpointer options)
85 actions_client_move(data, TRUE);
86 client_maximize(data->client, FALSE, o->dir);
87 actions_client_move(data, FALSE);
92 /* Always return FALSE because its not interactive */
93 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
98 actions_client_move(data, TRUE);
99 toggle = ((o->dir == HORZ && !data->client->max_horz) ||
100 (o->dir == VERT && !data->client->max_vert) ||
102 !(data->client->max_horz && data->client->max_vert)));
103 client_maximize(data->client, toggle, o->dir);
104 actions_client_move(data, FALSE);