]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/actions/shade.c
split shade back into shade/unshade/toggleshade
[mikachu/openbox.git] / openbox / actions / shade.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_shade_startup()
9 {
10     actions_register("Shade", NULL, NULL, run_func_on, NULL, NULL);
11     actions_register("Unshade", NULL, NULL, run_func_off, NULL, NULL);
12     actions_register("ToggleShade", NULL, NULL, run_func_toggle, NULL, NULL);
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_shade(data->client, TRUE);
21         actions_client_move(data, FALSE);
22     }
23     return FALSE;
24 }
25
26 static gboolean run_func_off(ObActionsData *data, gpointer options)
27 {
28     if (data->client) {
29         actions_client_move(data, TRUE);
30         client_shade(data->client, FALSE);
31         actions_client_move(data, FALSE);
32     }
33     return FALSE;
34 }
35
36 static gboolean run_func_toggle(ObActionsData *data, gpointer options)
37 {
38     if (data->client) {
39         actions_client_move(data, TRUE);
40         client_shade(data->client, !data->client->shaded);
41         actions_client_move(data, FALSE);
42     }
43     return FALSE;
44 }