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