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