]> Dogcows Code - chaz/openbox/blob - openbox/action.h
"oops"
[chaz/openbox] / openbox / action.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 action.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __action_h
20 #define __action_h
21
22 #include "misc.h"
23 #include "frame.h"
24 #include "parser/parse.h"
25
26 struct _ObClient;
27
28 typedef struct _ObAction ObAction;
29
30 /* These have to all have a Client* at the top even if they don't use it, so
31 that I can set it blindly later on. So every function will have a Client*
32 available (possibly NULL though) if it wants it.
33 */
34
35 typedef enum
36 {
37 OB_CLIENT_ACTION_NO,
38 OB_CLIENT_ACTION_OPTIONAL,
39 OB_CLIENT_ACTION_ALWAYS
40 } ObClientActionReq;
41
42 struct AnyAction {
43 ObClientActionReq client_action;
44 struct _ObClient *c;
45 ObFrameContext context;
46 gboolean interactive;
47 gint x;
48 gint y;
49 gint button;
50 };
51
52 struct InteractiveAction {
53 struct AnyAction any;
54 gboolean final;
55 gboolean cancel;
56 };
57
58 struct InterDirectionalAction{
59 struct InteractiveAction inter;
60 ObDirection direction;
61 gboolean dialog;
62 };
63
64 struct DirectionalAction{
65 struct AnyAction any;
66 ObDirection direction;
67 };
68
69 struct Execute {
70 struct AnyAction any;
71 gchar *path;
72 };
73
74 struct ClientAction {
75 struct AnyAction any;
76 };
77
78 struct Activate {
79 struct AnyAction any;
80 gboolean here; /* bring it to the current desktop */
81 };
82
83 struct MoveResizeRelative {
84 struct AnyAction any;
85 gint delta;
86 };
87
88 struct SendToDesktop {
89 struct AnyAction any;
90 guint desk;
91 gboolean follow;
92 };
93
94 struct SendToDesktopDirection {
95 struct InteractiveAction inter;
96 ObDirection dir;
97 gboolean wrap;
98 gboolean linear;
99 gboolean follow;
100 };
101
102 struct Desktop {
103 struct InteractiveAction inter;
104 guint desk;
105 };
106
107 struct Layer {
108 struct AnyAction any;
109 gint layer; /* < 0 = below, 0 = normal, > 0 = above */
110 };
111
112 struct DesktopDirection {
113 struct InteractiveAction inter;
114 ObDirection dir;
115 gboolean wrap;
116 gboolean linear;
117 };
118
119 struct MoveResize {
120 struct AnyAction any;
121 gboolean move;
122 gboolean keyboard;
123 };
124
125 struct ShowMenu {
126 struct AnyAction any;
127 gchar *name;
128 };
129
130 struct CycleWindows {
131 struct InteractiveAction inter;
132 gboolean linear;
133 gboolean forward;
134 gboolean dialog;
135 };
136
137 struct Stacking {
138 struct AnyAction any;
139 gboolean group;
140 };
141
142 union ActionData {
143 struct AnyAction any;
144 struct InteractiveAction inter;
145 struct InterDirectionalAction interdiraction;
146 struct DirectionalAction diraction;
147 struct Execute execute;
148 struct ClientAction client;
149 struct Activate activate;
150 struct MoveResizeRelative relative;
151 struct SendToDesktop sendto;
152 struct SendToDesktopDirection sendtodir;
153 struct Desktop desktop;
154 struct DesktopDirection desktopdir;
155 struct MoveResize moveresize;
156 struct ShowMenu showmenu;
157 struct CycleWindows cycle;
158 struct Layer layer;
159 struct Stacking stacking;
160 };
161
162 struct _ObAction {
163 guint ref;
164
165 /* The func member acts like an enum to tell which one of the structs in
166 the data union are valid.
167 */
168 void (*func)(union ActionData *data);
169 union ActionData data;
170 };
171
172 /* Creates a new Action from the name of the action
173 A few action types need data set after making this call still. Check if
174 the returned action's "func" is one of these.
175 action_execute - the path needs to be set
176 action_restart - the path can optionally be set
177 action_desktop - the destination desktop needs to be set
178 action_send_to_desktop - the destination desktop needs to be set
179 action_move_relative_horz - the delta
180 action_move_relative_vert - the delta
181 action_resize_relative_horz - the delta
182 action_resize_relative_vert - the delta
183 */
184
185 ObAction* action_from_string(const gchar *name, ObUserAction uact);
186 ObAction* action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
187 ObUserAction uact);
188 void action_ref(ObAction *a);
189 void action_unref(ObAction *a);
190
191 ObAction* action_copy(const ObAction *a);
192
193 /*! Executes a list of actions.
194 @param c The client associated with the action. Can be NULL.
195 @param state The keyboard modifiers state at the time the user action occured
196 @param button The mouse button used to execute the action.
197 @param x The x coord at which the user action occured.
198 @param y The y coord at which the user action occured.
199 @param cancel If the action is cancelling an interactive action. This only
200 affects interactive actions, but should generally always be FALSE.
201 @param done If the action is completing an interactive action. This only
202 affects interactive actions, but should generally always be FALSE.
203 */
204 void action_run_list(GSList *acts, struct _ObClient *c, ObFrameContext context,
205 guint state, guint button, gint x, gint y,
206 gboolean cancel, gboolean done);
207
208 #define action_run_mouse(a, c, n, s, b, x, y) \
209 action_run_list(a, c, n, s, b, x, y, FALSE, FALSE)
210
211 #define action_run_interactive(a, c, s, n, d) \
212 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, n, d)
213
214 #define action_run_key(a, c, s, x, y) \
215 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE, FALSE)
216
217 #define action_run(a, c, s) \
218 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE, FALSE)
219
220 void action_run_string(const gchar *name, struct _ObClient *c);
221
222 /* Execute */
223 void action_execute(union ActionData *data);
224 /* ActivateAction */
225 void action_activate(union ActionData *data);
226 /* ClientAction */
227 void action_focus(union ActionData *data);
228 /* ClientAction */
229 void action_unfocus(union ActionData *data);
230 /* ClientAction */
231 void action_iconify(union ActionData *data);
232 /* ClientAction */
233 void action_focus_order_to_bottom(union ActionData *data);
234 /* ClientAction */
235 void action_raiselower(union ActionData *data);
236 /* ClientAction */
237 void action_raise(union ActionData *data);
238 /* ClientAction */
239 void action_lower(union ActionData *data);
240 /* ClientAction */
241 void action_close(union ActionData *data);
242 /* ClientAction */
243 void action_kill(union ActionData *data);
244 /* ClientAction */
245 void action_shade(union ActionData *data);
246 /* ClientAction */
247 void action_shadelower(union ActionData *data);
248 /* ClientAction */
249 void action_unshaderaise(union ActionData *data);
250 /* ClientAction */
251 void action_unshade(union ActionData *data);
252 /* ClientAction */
253 void action_toggle_shade(union ActionData *data);
254 /* ClientAction */
255 void action_toggle_omnipresent(union ActionData *data);
256 /* MoveResizeRelative */
257 void action_move_relative_horz(union ActionData *data);
258 /* MoveResizeRelative */
259 void action_move_relative_vert(union ActionData *data);
260 /* ClientAction */
261 void action_move_to_center(union ActionData *data);
262 /* MoveResizeRelative */
263 void action_resize_relative_horz(union ActionData *data);
264 /* MoveResizeRelative */
265 void action_resize_relative_vert(union ActionData *data);
266 /* ClientAction */
267 void action_maximize_full(union ActionData *data);
268 /* ClientAction */
269 void action_unmaximize_full(union ActionData *data);
270 /* ClientAction */
271 void action_toggle_maximize_full(union ActionData *data);
272 /* ClientAction */
273 void action_maximize_horz(union ActionData *data);
274 /* ClientAction */
275 void action_unmaximize_horz(union ActionData *data);
276 /* ClientAction */
277 void action_toggle_maximize_horz(union ActionData *data);
278 /* ClientAction */
279 void action_maximize_vert(union ActionData *data);
280 /* ClientAction */
281 void action_unmaximize_vert(union ActionData *data);
282 /* ClientAction */
283 void action_toggle_maximize_vert(union ActionData *data);
284 /* ClientAction */
285 void action_toggle_fullscreen(union ActionData *data);
286 /* SendToDesktop */
287 void action_send_to_desktop(union ActionData *data);
288 /* SendToDesktopDirection */
289 void action_send_to_desktop_dir(union ActionData *data);
290 /* Desktop */
291 void action_desktop(union ActionData *data);
292 /* DesktopDirection */
293 void action_desktop_dir(union ActionData *data);
294 /* Any */
295 void action_desktop_last(union ActionData *data);
296 /* ClientAction */
297 void action_toggle_decorations(union ActionData *data);
298 /* MoveResize */
299 void action_moveresize(union ActionData *data);
300 /* Any */
301 void action_reconfigure(union ActionData *data);
302 /* Execute */
303 void action_restart(union ActionData *data);
304 /* Any */
305 void action_exit(union ActionData *data);
306 /* ShowMenu */
307 void action_showmenu(union ActionData *data);
308 /* CycleWindows */
309 void action_cycle_windows(union ActionData *data);
310 /* InterDirectionalAction */
311 void action_directional_focus(union ActionData *data);
312 /* DirectionalAction */
313 void action_movetoedge(union ActionData *data);
314 /* DirectionalAction */
315 void action_growtoedge(union ActionData *data);
316 /* Layer */
317 void action_send_to_layer(union ActionData *data);
318 /* Layer */
319 void action_toggle_layer(union ActionData *data);
320 /* Any */
321 void action_toggle_dockautohide(union ActionData *data);
322 /* Any */
323 void action_toggle_show_desktop(union ActionData *data);
324 /* Any */
325 void action_show_desktop(union ActionData *data);
326 /* Any */
327 void action_unshow_desktop(union ActionData *data);
328
329 #endif
This page took 0.048451 seconds and 4 git commands to generate.