1 #include "openbox/action.h"
2 #include "openbox/action_list_run.h"
3 #include "openbox/client.h"
4 #include "openbox/client_set.h"
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);
13 void action_decorations_startup(void)
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);
23 static gboolean each_on(ObClient *c, const ObActionListRun *data, gpointer o)
25 client_set_undecorated(data->target, FALSE);
29 /* Always return FALSE because its not interactive */
30 static gboolean run_func_on(const ObClientSet *set,
31 const ObActionListRun *data, gpointer options)
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);
41 static gboolean each_off(ObClient *c, const ObActionListRun *data, gpointer o)
43 client_set_undecorated(data->target, TRUE);
47 /* Always return FALSE because its not interactive */
48 static gboolean run_func_off(const ObClientSet *set,
49 const ObActionListRun *data, gpointer options)
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);
59 static gboolean each_flip(ObClient *c, const ObActionListRun *data, gpointer o)
61 client_set_undecorated(data->target, !c->undecorated);
65 /* Always return FALSE because its not interactive */
66 static gboolean run_func_toggle(const ObClientSet *set,
67 const ObActionListRun *data, gpointer options)
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);