1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 action.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
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.
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.
17 See the COPYING file for a copy of the GNU General Public License.
25 #include "parser/parse.h"
29 typedef struct _ObAction ObAction;
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.
39 OB_CLIENT_ACTION_OPTIONAL,
40 OB_CLIENT_ACTION_ALWAYS
44 ObClientActionReq client_action;
46 ObFrameContext context;
54 struct InteractiveAction {
60 struct InterDirectionalAction{
61 struct InteractiveAction inter;
62 ObDirection direction;
64 gboolean dock_windows;
65 gboolean desktop_windows;
68 struct DirectionalAction{
70 ObDirection direction;
81 gboolean startupnotify;
92 gboolean here; /* bring it to the current desktop */
95 struct MoveResizeRelative {
103 struct SendToDesktop {
104 struct AnyAction any;
109 struct SendToDesktopDirection {
110 struct InteractiveAction inter;
118 struct AnyAction inter;
123 struct AnyAction any;
124 gint layer; /* < 0 = below, 0 = normal, > 0 = above */
127 struct DesktopDirection {
128 struct InteractiveAction inter;
135 struct AnyAction any;
141 struct AnyAction any;
145 struct AddRemoveDesktop {
146 struct AnyAction any;
150 struct CycleWindows {
151 struct InteractiveAction inter;
155 gboolean dock_windows;
156 gboolean desktop_windows;
157 gboolean all_desktops;
161 struct AnyAction any;
165 struct AnyAction any;
166 struct InteractiveAction inter;
167 struct InterDirectionalAction interdiraction;
168 struct DirectionalAction diraction;
170 struct Execute execute;
171 struct ClientAction client;
172 struct Activate activate;
173 struct MoveResizeRelative relative;
174 struct SendToDesktop sendto;
175 struct SendToDesktopDirection sendtodir;
176 struct Desktop desktop;
177 struct DesktopDirection desktopdir;
178 struct MoveResize moveresize;
179 struct ShowMenu showmenu;
180 struct CycleWindows cycle;
182 struct Stacking stacking;
183 struct AddRemoveDesktop addremovedesktop;
189 /* The func member acts like an enum to tell which one of the structs in
190 the data union are valid.
192 void (*func)(union ActionData *data);
193 union ActionData data;
196 /* Creates a new Action from the name of the action
197 A few action types need data set after making this call still. Check if
198 the returned action's "func" is one of these.
199 action_debug - the string to print should be set
200 action_execute - the path needs to be set
201 action_restart - the path can optionally be set
202 action_desktop - the destination desktop needs to be set
203 action_send_to_desktop - the destination desktop needs to be set
204 action_move_relative_horz - the delta
205 action_move_relative_vert - the delta
206 action_resize_relative_horz - the delta
207 action_resize_relative_vert - the delta
208 action_move_relative - the deltas
209 action_resize_relative - the deltas
212 ObAction* action_from_string(const gchar *name, ObUserAction uact);
213 ObAction* action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
215 void action_ref(ObAction *a);
216 void action_unref(ObAction *a);
218 ObAction* action_copy(const ObAction *a);
220 /*! Executes a list of actions.
221 @param c The client associated with the action. Can be NULL.
222 @param state The keyboard modifiers state at the time the user action occured
223 @param button The mouse button used to execute the action.
224 @param x The x coord at which the user action occured.
225 @param y The y coord at which the user action occured.
226 @param cancel If the action is cancelling an interactive action. This only
227 affects interactive actions, but should generally always be FALSE.
228 @param done If the action is completing an interactive action. This only
229 affects interactive actions, but should generally always be FALSE.
231 void action_run_list(GSList *acts, struct _ObClient *c, ObFrameContext context,
232 guint state, guint button, gint x, gint y, Time time,
233 gboolean cancel, gboolean done);
235 #define action_run_mouse(a, c, n, s, b, x, y, t) \
236 action_run_list(a, c, n, s, b, x, y, t, FALSE, FALSE)
238 #define action_run_interactive(a, c, s, t, n, d) \
239 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, n, d)
241 #define action_run_key(a, c, s, x, y, t) \
242 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, t, FALSE, FALSE)
244 #define action_run(a, c, s, t) \
245 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, FALSE, FALSE)
247 void action_run_string(const gchar *name, struct _ObClient *c, Time time);
250 void action_debug(union ActionData *data);
252 void action_execute(union ActionData *data);
254 void action_activate(union ActionData *data);
256 void action_focus(union ActionData *data);
258 void action_unfocus(union ActionData *data);
260 void action_iconify(union ActionData *data);
262 void action_focus_order_to_bottom(union ActionData *data);
264 void action_raiselower(union ActionData *data);
266 void action_raise(union ActionData *data);
268 void action_lower(union ActionData *data);
270 void action_close(union ActionData *data);
272 void action_kill(union ActionData *data);
274 void action_shade(union ActionData *data);
276 void action_shadelower(union ActionData *data);
278 void action_unshaderaise(union ActionData *data);
280 void action_unshade(union ActionData *data);
282 void action_toggle_shade(union ActionData *data);
284 void action_toggle_omnipresent(union ActionData *data);
285 /* MoveResizeRelative */
286 void action_move_relative_horz(union ActionData *data);
287 /* MoveResizeRelative */
288 void action_move_relative_vert(union ActionData *data);
289 /* MoveResizeRelative */
290 void action_move_relative(union ActionData *data);
291 /* MoveResizeRelative */
292 void action_resize_relative(union ActionData *data);
294 void action_move_to_center(union ActionData *data);
295 /* MoveResizeRelative */
296 void action_resize_relative_horz(union ActionData *data);
297 /* MoveResizeRelative */
298 void action_resize_relative_vert(union ActionData *data);
300 void action_maximize_full(union ActionData *data);
302 void action_unmaximize_full(union ActionData *data);
304 void action_toggle_maximize_full(union ActionData *data);
306 void action_maximize_horz(union ActionData *data);
308 void action_unmaximize_horz(union ActionData *data);
310 void action_toggle_maximize_horz(union ActionData *data);
312 void action_maximize_vert(union ActionData *data);
314 void action_unmaximize_vert(union ActionData *data);
316 void action_toggle_maximize_vert(union ActionData *data);
318 void action_toggle_fullscreen(union ActionData *data);
320 void action_send_to_desktop(union ActionData *data);
321 /* SendToDesktopDirection */
322 void action_send_to_desktop_dir(union ActionData *data);
324 void action_desktop(union ActionData *data);
325 /* DesktopDirection */
326 void action_desktop_dir(union ActionData *data);
328 void action_desktop_last(union ActionData *data);
330 void action_toggle_decorations(union ActionData *data);
332 void action_move(union ActionData *data);
334 void action_resize(union ActionData *data);
336 void action_reconfigure(union ActionData *data);
338 void action_restart(union ActionData *data);
340 void action_exit(union ActionData *data);
342 void action_showmenu(union ActionData *data);
344 void action_cycle_windows(union ActionData *data);
345 /* InterDirectionalAction */
346 void action_directional_focus(union ActionData *data);
347 /* DirectionalAction */
348 void action_movetoedge(union ActionData *data);
349 /* DirectionalAction */
350 void action_growtoedge(union ActionData *data);
352 void action_send_to_layer(union ActionData *data);
354 void action_toggle_layer(union ActionData *data);
356 void action_toggle_dockautohide(union ActionData *data);
358 void action_toggle_show_desktop(union ActionData *data);
360 void action_show_desktop(union ActionData *data);
362 void action_unshow_desktop(union ActionData *data);
364 void action_break_chroot(union ActionData *data);
365 /* AddRemoveDesktop */
366 void action_add_desktop(union ActionData *data);
367 /* AddRemoveDesktop */
368 void action_remove_desktop(union ActionData *data);