1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 action.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
24 #include "parser/parse.h"
28 typedef struct _ObAction ObAction;
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.
43 struct InteractiveAction {
49 struct InterDirectionalAction{
50 struct InteractiveAction inter;
51 ObDirection direction;
54 struct DirectionalAction{
56 ObDirection direction;
70 gboolean here; /* bring it to the current desktop */
73 struct MoveResizeRelative {
78 struct SendToDesktop {
84 struct SendToDesktopDirection {
85 struct InteractiveAction inter;
99 int layer; /* < 0 = below, 0 = normal, > 0 = above */
102 struct DesktopDirection {
103 struct InteractiveAction inter;
110 struct AnyAction any;
116 struct AnyAction any;
120 struct CycleWindows {
121 struct InteractiveAction inter;
127 struct AnyAction any;
128 struct InteractiveAction inter;
129 struct InterDirectionalAction interdiraction;
130 struct DirectionalAction diraction;
131 struct Execute execute;
132 struct ClientAction client;
133 struct Activate activate;
134 struct MoveResizeRelative relative;
135 struct SendToDesktop sendto;
136 struct SendToDesktopDirection sendtodir;
137 struct Desktop desktop;
138 struct DesktopDirection desktopdir;
139 struct MoveResize moveresize;
140 struct ShowMenu showmenu;
141 struct CycleWindows cycle;
147 /* The func member acts like an enum to tell which one of the structs in
148 the data union are valid.
150 void (*func)(union ActionData *data);
151 union ActionData data;
154 /* Creates a new Action from the name of the action
155 A few action types need data set after making this call still. Check if
156 the returned action's "func" is one of these.
157 action_execute - the path needs to be set
158 action_restart - the path can optionally be set
159 action_desktop - the destination desktop needs to be set
160 action_send_to_desktop - the destination desktop needs to be set
161 action_move_relative_horz - the delta
162 action_move_relative_vert - the delta
163 action_resize_relative_horz - the delta
164 action_resize_relative_vert - the delta
167 ObAction *action_from_string(const gchar *name, ObUserAction uact);
168 ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
170 void action_free(ObAction *a);
172 /*! Executes a list of actions.
173 @param c The client associated with the action. Can be NULL.
174 @param state The keyboard modifiers state at the time the user action occured
175 @param button The mouse button used to execute the action.
176 @param x The x coord at which the user action occured.
177 @param y The y coord at which the user action occured.
178 @param cancel If the action is cancelling an interactive action. This only
179 affects interactive actions, but should generally always be FALSE.
180 @param done If the action is completing an interactive action. This only
181 affects interactive actions, but should generally always be FALSE.
183 void action_run_list(GSList *acts, struct _ObClient *c,
184 guint state, guint button, gint x, gint y,
185 gboolean cancel, gboolean done);
187 #define action_run_mouse(a, c, s, b, x, y) \
188 action_run_list(a, c, s, b, x, y, FALSE, FALSE)
190 #define action_run_interactive(a, c, s, n, d) \
191 action_run_list(a, c, s, 0, -1, -1, n, d)
193 #define action_run_key(a, c, s, x, y) \
194 action_run_list(a, c, s, 0, x, y, FALSE, FALSE)
196 #define action_run(a, c, s) \
197 action_run_list(a, c, s, 0, -1, -1, FALSE, FALSE)
200 void action_execute(union ActionData *data);
202 void action_activate(union ActionData *data);
204 void action_focus(union ActionData *data);
206 void action_unfocus(union ActionData *data);
208 void action_iconify(union ActionData *data);
210 void action_raiselower(union ActionData *data);
212 void action_raise(union ActionData *data);
214 void action_lower(union ActionData *data);
216 void action_close(union ActionData *data);
218 void action_kill(union ActionData *data);
220 void action_shade(union ActionData *data);
222 void action_shadelower(union ActionData *data);
224 void action_unshaderaise(union ActionData *data);
226 void action_unshade(union ActionData *data);
228 void action_toggle_shade(union ActionData *data);
230 void action_toggle_omnipresent(union ActionData *data);
231 /* MoveResizeRelative */
232 void action_move_relative_horz(union ActionData *data);
233 /* MoveResizeRelative */
234 void action_move_relative_vert(union ActionData *data);
235 /* MoveResizeRelative */
236 void action_resize_relative_horz(union ActionData *data);
237 /* MoveResizeRelative */
238 void action_resize_relative_vert(union ActionData *data);
240 void action_maximize_full(union ActionData *data);
242 void action_unmaximize_full(union ActionData *data);
244 void action_toggle_maximize_full(union ActionData *data);
246 void action_maximize_horz(union ActionData *data);
248 void action_unmaximize_horz(union ActionData *data);
250 void action_toggle_maximize_horz(union ActionData *data);
252 void action_maximize_vert(union ActionData *data);
254 void action_unmaximize_vert(union ActionData *data);
256 void action_toggle_maximize_vert(union ActionData *data);
258 void action_send_to_desktop(union ActionData *data);
259 /* SendToDesktopDirection */
260 void action_send_to_desktop_dir(union ActionData *data);
262 void action_desktop(union ActionData *data);
263 /* DesktopDirection */
264 void action_desktop_dir(union ActionData *data);
266 void action_desktop_last(union ActionData *data);
268 void action_toggle_decorations(union ActionData *data);
270 void action_moveresize(union ActionData *data);
272 void action_reconfigure(union ActionData *data);
274 void action_restart(union ActionData *data);
276 void action_exit(union ActionData *data);
278 void action_showmenu(union ActionData *data);
280 void action_cycle_windows(union ActionData *data);
281 /* InterDirectionalAction */
282 void action_directional_focus(union ActionData *data);
283 /* DirectionalAction */
284 void action_movetoedge(union ActionData *data);
285 /* DirectionalAction */
286 void action_growtoedge(union ActionData *data);
288 void action_send_to_layer(union ActionData *data);
290 void action_toggle_layer(union ActionData *data);
292 void action_toggle_show_desktop(union ActionData *data);
294 void action_show_desktop(union ActionData *data);
296 void action_unshow_desktop(union ActionData *data);