Make it possible for an action name to choose whether it is interactive or not based...
[dana/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(void)
9 {
10     actions_register("Decorate", NULL, NULL, run_func_on);
11     actions_register("Undecorate", NULL, NULL, run_func_off);
12     actions_register("ToggleDecorations", NULL, NULL, run_func_toggle);
13 }
14
15 /* Always return FALSE because its not interactive */
16 static gboolean run_func_on(ObActionsData *data, gpointer options)
17 {
18     if (data->client) {
19         actions_client_move(data, TRUE);
20         client_set_undecorated(data->client, FALSE);
21         actions_client_move(data, FALSE);
22     }
23     return FALSE;
24 }
25
26 /* Always return FALSE because its not interactive */
27 static gboolean run_func_off(ObActionsData *data, gpointer options)
28 {
29     if (data->client) {
30         actions_client_move(data, TRUE);
31         client_set_undecorated(data->client, TRUE);
32         actions_client_move(data, FALSE);
33     }
34     return FALSE;
35 }
36
37 /* Always return FALSE because its not interactive */
38 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
39 {
40     if (data->client) {
41         actions_client_move(data, TRUE);
42         client_set_undecorated(data->client, !data->client->undecorated);
43         actions_client_move(data, FALSE);
44     }
45     return FALSE;
46 }