this is a big one! im putting stats in here just cuz!
[mikachu/openbox.git] / openbox / action.h
1 #ifndef __action_h
2 #define __action_h
3
4 #include "client.h"
5 #include "parser/parse.h"
6
7 /* These have to all have a Client* at the top even if they don't use it, so
8    that I can set it blindly later on. So every function will have a Client*
9    available (possibly NULL though) if it wants it.
10 */
11
12 struct AnyAction {
13     Client *c;
14 };
15
16 struct DirectionalAction{
17     Client *c;
18     int direction;
19 };
20
21 struct Execute {
22     Client *c;
23     char *path;
24 };
25
26 struct ClientAction {
27     Client *c;
28 };
29
30 struct MoveResizeRelative {
31     Client *c;
32     int delta;
33 };
34
35 struct SendToDesktop {
36     Client *c;
37     guint desk;
38     gboolean follow;
39 };
40
41 struct SendToDesktopDirection {
42     Client *c;
43     gboolean wrap;
44     gboolean follow;
45 };
46
47 struct Desktop {
48     Client *c;
49     guint desk;
50 };
51
52 struct Layer {
53     Client *c;
54     int layer; /* < 0 = below, 0 = normal, > 0 = above */
55 };
56
57 struct DesktopDirection {
58     Client *c;
59     gboolean wrap;
60 };
61
62 struct MoveResize {
63     Client *c;
64     int x;
65     int y;
66     guint32 corner; /* prop_atoms.net_wm_moveresize_* */
67     guint button;
68 };
69
70 struct ShowMenu {
71     Client *c;
72     char *name;
73     int x;
74     int y;
75 };
76
77 struct CycleWindows {
78     Client *c;
79     gboolean linear;
80     gboolean forward;
81     gboolean final;
82     gboolean cancel;
83 };
84
85 union ActionData {
86     struct AnyAction any;
87     struct DirectionalAction diraction;
88     struct Execute execute;
89     struct ClientAction client;
90     struct MoveResizeRelative relative;
91     struct SendToDesktop sendto;
92     struct SendToDesktopDirection sendtodir;
93     struct Desktop desktop;
94     struct DesktopDirection desktopdir;
95     struct MoveResize moveresize;
96     struct ShowMenu showmenu;
97     struct CycleWindows cycle;
98     struct Layer layer;
99 };
100
101 typedef struct {
102     /* The func member acts like an enum to tell which one of the structs in
103        the data union are valid.
104     */
105     void (*func)(union ActionData *data);
106     union ActionData data;
107 } Action;
108
109 Action *action_new(void (*func)(union ActionData *data));
110
111 /* Creates a new Action from the name of the action
112    A few action types need data set after making this call still. Check if
113    the returned action's "func" is one of these.
114    action_execute - the path needs to be set
115    action_restart - the path can optionally be set
116    action_desktop - the destination desktop needs to be set
117    action_move_relative_horz - the delta
118    action_move_relative_vert - the delta
119    action_resize_relative_horz - the delta
120    action_resize_relative_vert - the delta
121 */
122
123 Action *action_from_string(char *name);
124 Action *action_parse(xmlDocPtr doc, xmlNodePtr node);
125 void action_free(Action *a);
126
127 /* Execute */
128 void action_execute(union ActionData *data);
129 /* ClientAction */
130 void action_focus(union ActionData *data);
131 /* ClientAction */
132 void action_unfocus(union ActionData *data);
133 /* ClientAction */
134 void action_iconify(union ActionData *data);
135 /* ClientAction */
136 void action_raise(union ActionData *data);
137 /* ClientAction */
138 void action_lower(union ActionData *data);
139 /* ClientAction */
140 void action_focusraise(union ActionData *data);
141 /* ClientAction */
142 void action_close(union ActionData *data);
143 /* ClientAction */
144 void action_kill(union ActionData *data);
145 /* ClientAction */
146 void action_shade(union ActionData *data);
147 /* ClientAction */
148 void action_shadelower(union ActionData *data);
149 /* ClientAction */
150 void action_unshaderaise(union ActionData *data);
151 /* ClientAction */
152 void action_unshade(union ActionData *data);
153 /* ClientAction */
154 void action_toggle_shade(union ActionData *data);
155 /* ClientAction */
156 void action_toggle_omnipresent(union ActionData *data);
157 /* MoveResizeRelative */
158 void action_move_relative_horz(union ActionData *data);
159 /* MoveResizeRelative */
160 void action_move_relative_vert(union ActionData *data);
161 /* MoveResizeRelative */
162 void action_resize_relative_horz(union ActionData *data);
163 /* MoveResizeRelative */
164 void action_resize_relative_vert(union ActionData *data);
165 /* ClientAction */
166 void action_maximize_full(union ActionData *data);
167 /* ClientAction */
168 void action_unmaximize_full(union ActionData *data);
169 /* ClientAction */
170 void action_toggle_maximize_full(union ActionData *data);
171 /* ClientAction */
172 void action_maximize_horz(union ActionData *data);
173 /* ClientAction */
174 void action_unmaximize_horz(union ActionData *data);
175 /* ClientAction */
176 void action_toggle_maximize_horz(union ActionData *data);
177 /* ClientAction */
178 void action_maximize_vert(union ActionData *data);
179 /* ClientAction */
180 void action_unmaximize_vert(union ActionData *data);
181 /* ClientAction */
182 void action_toggle_maximize_vert(union ActionData *data);
183 /* SendToDesktop */
184 void action_send_to_desktop(union ActionData *data);
185 /* SendToDesktopDirection */
186 void action_send_to_desktop_right(union ActionData *data);
187 /* SendToDesktopDirection */
188 void action_send_to_desktop_left(union ActionData *data);
189 /* SendToDesktopDirection */
190 void action_send_to_desktop_up(union ActionData *data);
191 /* SendToDesktopDirection */
192 void action_send_to_desktop_down(union ActionData *data);
193 /* Desktop */
194 void action_desktop(union ActionData *data);
195 /* DesktopDirection */
196 void action_desktop_right(union ActionData *data);
197 /* DesktopDirection */
198 void action_desktop_left(union ActionData *data);
199 /* DesktopDirection */
200 void action_desktop_up(union ActionData *data);
201 /* DesktopDirection */
202 void action_desktop_down(union ActionData *data);
203 /* ClientAction */
204 void action_toggle_decorations(union ActionData *data);
205 /* MoveResize */
206 void action_moveresize(union ActionData *data);
207 /* Execute */
208 void action_restart(union ActionData *data);
209 /* Any */
210 void action_exit(union ActionData *data);
211 /* ShowMenu */
212 void action_showmenu(union ActionData *data);
213 /* CycleWindows */
214 void action_cycle_windows(union ActionData *data);
215 /* DirectionalAction */
216 void action_directional_focus(union ActionData *data);
217 /* DirectionalAction */
218 void action_movetoedge(union ActionData *data);
219 /* Layer */
220 void action_send_to_layer(union ActionData *data);
221 /* Layer */
222 void action_toggle_layer(union ActionData *data);
223 /* Any */
224 void action_toggle_show_desktop(union ActionData *data);
225 /* Any */
226 void action_show_desktop(union ActionData *data);
227 /* Any */
228 void action_unshow_desktop(union ActionData *data);
229
230 #endif