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