]> icculus.org git repositories - dana/openbox.git/blob - openbox/actions/fullscreen.c
Pass a client set to all actions, and make focus cycling use a client set.
[dana/openbox.git] / openbox / actions / fullscreen.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_fullscreen_startup(void)
14 {
15     action_register("Fullscreen", OB_ACTION_DEFAULT_FILTER_SINGLE,
16                     NULL, NULL, run_func_on);
17     action_register("Unfullscreen", OB_ACTION_DEFAULT_FILTER_SINGLE,
18                     NULL, NULL, run_func_off);
19     action_register("ToggleFullscreen", OB_ACTION_DEFAULT_FILTER_SINGLE,
20                     NULL, NULL, run_func_toggle);
21 }
22
23 static gboolean each_on(ObClient *c, const ObActionListRun *data,
24                          gpointer options)
25 {
26     client_fullscreen(c, TRUE);
27     return TRUE;
28 }
29
30 /* Always return FALSE because its not interactive */
31 static gboolean run_func_on(const ObClientSet *set,
32                             const ObActionListRun *data, gpointer options)
33 {
34     action_client_move(data, TRUE);
35     client_set_run(set, data, each_on, options);
36     action_client_move(data, FALSE);
37     return FALSE;
38 }
39
40 static gboolean each_off(ObClient *c, const ObActionListRun *data,
41                          gpointer options)
42 {
43     client_fullscreen(c, FALSE);
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     action_client_move(data, TRUE);
52     client_set_run(set, data, each_off, options);
53     action_client_move(data, FALSE);
54     return FALSE;
55 }
56
57 static gboolean each_toggle(ObClient *c, const ObActionListRun *data,
58                          gpointer options)
59 {
60     client_fullscreen(c, !c->fullscreen);
61     return TRUE;
62 }
63
64 /* Always return FALSE because its not interactive */
65 static gboolean run_func_toggle(const ObClientSet *set,
66                                 const ObActionListRun *data, gpointer options)
67 {
68     if (!client_set_is_empty(set)) {
69         action_client_move(data, TRUE);
70         client_set_run(set, data, each_toggle, options);
71         action_client_move(data, FALSE);
72     }
73     return FALSE;
74 }