bee25f3e25ce0da34a01b530c12c74dcf53ecaeb
[mikachu/openbox.git] / openbox / actions / decorations.c
1 #include "openbox/actions.h"
2 #include "openbox/client.h"
3
4 static gboolean run_func_on(ObActionsData *data, gpointer options);
5 static gboolean run_func_off(ObActionsData *data, gpointer options);
6 static gboolean run_func_toggle(ObActionsData *data, gpointer options);
7
8 void action_decorations_startup()
9 {
10     actions_register("Decorate", NULL, NULL, run_func_on, NULL, NULL);
11     actions_register("Undecorate", NULL, NULL, run_func_off, NULL, NULL);
12     actions_register("ToggleDecorations", NULL, NULL, run_func_toggle,
13                      NULL, NULL);
14 }
15
16 /* Always return FALSE because its not interactive */
17 static gboolean run_func_on(ObActionsData *data, gpointer options)
18 {
19     if (data->client) {
20         actions_client_move(data, TRUE);
21         client_set_undecorated(data->client, FALSE);
22         actions_client_move(data, FALSE);
23     }
24     return FALSE;
25 }
26
27 /* Always return FALSE because its not interactive */
28 static gboolean run_func_off(ObActionsData *data, gpointer options)
29 {
30     if (data->client) {
31         actions_client_move(data, TRUE);
32         client_set_undecorated(data->client, TRUE);
33         actions_client_move(data, FALSE);
34     }
35     return FALSE;
36 }
37
38 /* Always return FALSE because its not interactive */
39 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
40 {
41     if (data->client) {
42         actions_client_move(data, TRUE);
43         client_set_undecorated(data->client, !data->client->undecorated);
44         actions_client_move(data, FALSE);
45     }
46     return FALSE;
47 }