]>
Dogcows Code - chaz/openbox/blob - openbox/actions/maximize.c
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
,
28 actions_register("Unmaximize", setup_func
, g_free
, run_func_off
,
30 actions_register("ToggleMaximize", setup_func
, g_free
, run_func_toggle
,
32 /* 3.4-compatibility */
33 actions_register("MaximizeFull", setup_both_func
, g_free
,
34 run_func_on
, NULL
, NULL
);
35 actions_register("UnmaximizeFull", setup_both_func
, g_free
,
36 run_func_off
, NULL
, NULL
);
37 actions_register("ToggleMaximizeFull", setup_both_func
, g_free
,
38 run_func_toggle
, NULL
, NULL
);
39 actions_register("MaximizeHorz", setup_horz_func
, g_free
,
40 run_func_on
, NULL
, NULL
);
41 actions_register("UnmaximizeHorz", setup_horz_func
, g_free
,
42 run_func_off
, NULL
, NULL
);
43 actions_register("ToggleMaximizeHorz", setup_horz_func
, g_free
,
44 run_func_toggle
, NULL
, NULL
);
45 actions_register("MaximizeVert", setup_vert_func
, g_free
,
46 run_func_on
, NULL
, NULL
);
47 actions_register("UnmaximizeVert", setup_vert_func
, g_free
,
48 run_func_off
, NULL
, NULL
);
49 actions_register("ToggleMaximizeVert", setup_vert_func
, g_free
,
50 run_func_toggle
, NULL
, NULL
);
53 static gpointer
setup_func(xmlNodePtr node
)
58 o
= g_new0(Options
, 1);
61 if ((n
= obt_parse_find_node(node
, "direction"))) {
62 gchar
*s
= obt_parse_node_string(n
);
63 if (!g_ascii_strcasecmp(s
, "vertical") ||
64 !g_ascii_strcasecmp(s
, "vert"))
66 else if (!g_ascii_strcasecmp(s
, "horizontal") ||
67 !g_ascii_strcasecmp(s
, "horz"))
75 /* Always return FALSE because its not interactive */
76 static gboolean
run_func_on(ObActionsData
*data
, gpointer options
)
80 actions_client_move(data
, TRUE
);
81 client_maximize(data
->client
, TRUE
, o
->dir
);
82 actions_client_move(data
, FALSE
);
87 /* Always return FALSE because its not interactive */
88 static gboolean
run_func_off(ObActionsData
*data
, gpointer options
)
92 actions_client_move(data
, TRUE
);
93 client_maximize(data
->client
, FALSE
, o
->dir
);
94 actions_client_move(data
, FALSE
);
99 /* Always return FALSE because its not interactive */
100 static gboolean
run_func_toggle(ObActionsData
*data
, gpointer options
)
102 Options
*o
= options
;
105 actions_client_move(data
, TRUE
);
106 toggle
= ((o
->dir
== HORZ
&& !data
->client
->max_horz
) ||
107 (o
->dir
== VERT
&& !data
->client
->max_vert
) ||
109 !(data
->client
->max_horz
&& data
->client
->max_vert
)));
110 client_maximize(data
->client
, toggle
, o
->dir
);
111 actions_client_move(data
, FALSE
);
116 /* 3.4-compatibility */
117 static gpointer
setup_both_func(xmlNodePtr node
)
119 Options
*o
= g_new0(Options
, 1);
124 static gpointer
setup_horz_func(xmlNodePtr node
)
126 Options
*o
= g_new0(Options
, 1);
131 static gpointer
setup_vert_func(xmlNodePtr node
)
133 Options
*o
= g_new0(Options
, 1);
This page took 0.041908 seconds and 5 git commands to generate.