]> icculus.org git repositories - dana/openbox.git/blob - openbox/actions/decorations.c
Pass a client set to all actions, and make focus cycling use a client set.
[dana/openbox.git] / openbox / actions / decorations.c
1 #include "openbox/action.h"
2 #include "openbox/action_list_run.h"
3 #include "openbox/client.h"
4 #include "openbox/client_set.h"
5
6 static gboolean run_func_on(const ObClientSet *set,
7                             const ObActionListRun *data, gpointer options);
8 static gboolean run_func_off(const ObClientSet *set,
9                              const ObActionListRun *data, gpointer options);
10 static gboolean run_func_toggle(const ObClientSet *set,
11                                 const ObActionListRun *data, gpointer options);
12
13 void action_decorations_startup(void)
14 {
15     action_register("Decorate", OB_ACTION_DEFAULT_FILTER_SINGLE,
16                     NULL, NULL, run_func_on);
17     action_register("Undecorate", OB_ACTION_DEFAULT_FILTER_SINGLE,
18                     NULL, NULL, run_func_off);
19     action_register("ToggleDecorations", OB_ACTION_DEFAULT_FILTER_SINGLE,
20                     NULL, NULL, run_func_toggle);
21 }
22
23 static gboolean each_on(ObClient *c, const ObActionListRun *data, gpointer o)
24 {
25     client_set_undecorated(data->target, FALSE);
26     return TRUE;
27 }
28
29 /* Always return FALSE because its not interactive */
30 static gboolean run_func_on(const ObClientSet *set,
31                             const ObActionListRun *data, gpointer options)
32 {
33     if (!client_set_is_empty(set)) {
34         action_client_move(data, TRUE);
35         client_set_run(set, data, each_on, options);
36         action_client_move(data, FALSE);
37     }
38     return FALSE;
39 }
40
41 static gboolean each_off(ObClient *c, const ObActionListRun *data, gpointer o)
42 {
43     client_set_undecorated(data->target, TRUE);
44     return TRUE;
45 }
46
47 /* Always return FALSE because its not interactive */
48 static gboolean run_func_off(const ObClientSet *set,
49                              const ObActionListRun *data, gpointer options)
50 {
51     if (!client_set_is_empty(set)) {
52         action_client_move(data, TRUE);
53         client_set_run(set, data, each_off, options);
54         action_client_move(data, FALSE);
55     }
56     return FALSE;
57 }
58
59 static gboolean each_flip(ObClient *c, const ObActionListRun *data, gpointer o)
60 {
61     client_set_undecorated(data->target, !c->undecorated);
62     return TRUE;
63 }
64
65 /* Always return FALSE because its not interactive */
66 static gboolean run_func_toggle(const ObClientSet *set,
67                                 const ObActionListRun *data, gpointer options)
68 {
69     if (!client_set_is_empty(set)) {
70         action_client_move(data, TRUE);
71         client_set_run(set, data, each_flip, options);
72         action_client_move(data, FALSE);
73     }
74     return FALSE;
75 }