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 Ben 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
;
66 struct DirectionalAction
{
68 ObDirection direction
;
75 gboolean startupnotify
;
86 gboolean here
; /* bring it to the current desktop */
89 struct MoveResizeRelative
{
97 struct SendToDesktop
{
103 struct SendToDesktopDirection
{
104 struct InteractiveAction inter
;
112 struct InteractiveAction inter
;
117 struct AnyAction any
;
118 gint layer
; /* < 0 = below, 0 = normal, > 0 = above */
121 struct DesktopDirection
{
122 struct InteractiveAction inter
;
129 struct AnyAction any
;
135 struct AnyAction any
;
139 struct CycleWindows
{
140 struct InteractiveAction inter
;
147 struct AnyAction any
;
151 struct AnyAction any
;
152 struct InteractiveAction inter
;
153 struct InterDirectionalAction interdiraction
;
154 struct DirectionalAction diraction
;
155 struct Execute execute
;
156 struct ClientAction client
;
157 struct Activate activate
;
158 struct MoveResizeRelative relative
;
159 struct SendToDesktop sendto
;
160 struct SendToDesktopDirection sendtodir
;
161 struct Desktop desktop
;
162 struct DesktopDirection desktopdir
;
163 struct MoveResize moveresize
;
164 struct ShowMenu showmenu
;
165 struct CycleWindows cycle
;
167 struct Stacking stacking
;
173 /* The func member acts like an enum to tell which one of the structs in
174 the data union are valid.
176 void (*func
)(union ActionData
*data
);
177 union ActionData data
;
180 /* Creates a new Action from the name of the action
181 A few action types need data set after making this call still. Check if
182 the returned action's "func" is one of these.
183 action_execute - the path needs to be set
184 action_restart - the path can optionally be set
185 action_desktop - the destination desktop needs to be set
186 action_send_to_desktop - the destination desktop needs to be set
187 action_move_relative_horz - the delta
188 action_move_relative_vert - the delta
189 action_resize_relative_horz - the delta
190 action_resize_relative_vert - the delta
191 action_move_relative - the deltas
192 action_resize_relative - the deltas
195 ObAction
* action_from_string(const gchar
*name
, ObUserAction uact
);
196 ObAction
* action_parse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
198 void action_ref(ObAction
*a
);
199 void action_unref(ObAction
*a
);
201 ObAction
* action_copy(const ObAction
*a
);
203 /*! Executes a list of actions.
204 @param c The client associated with the action. Can be NULL.
205 @param state The keyboard modifiers state at the time the user action occured
206 @param button The mouse button used to execute the action.
207 @param x The x coord at which the user action occured.
208 @param y The y coord at which the user action occured.
209 @param cancel If the action is cancelling an interactive action. This only
210 affects interactive actions, but should generally always be FALSE.
211 @param done If the action is completing an interactive action. This only
212 affects interactive actions, but should generally always be FALSE.
214 void action_run_list(GSList
*acts
, struct _ObClient
*c
, ObFrameContext context
,
215 guint state
, guint button
, gint x
, gint y
, Time time
,
216 gboolean cancel
, gboolean done
);
218 #define action_run_mouse(a, c, n, s, b, x, y, t) \
219 action_run_list(a, c, n, s, b, x, y, t, FALSE, FALSE)
221 #define action_run_interactive(a, c, s, t, n, d) \
222 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, n, d)
224 #define action_run_key(a, c, s, x, y, t) \
225 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, t, FALSE, FALSE)
227 #define action_run(a, c, s, t) \
228 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, FALSE, FALSE)
230 void action_run_string(const gchar
*name
, struct _ObClient
*c
, Time time
);
233 void action_execute(union ActionData
*data
);
235 void action_activate(union ActionData
*data
);
237 void action_focus(union ActionData
*data
);
239 void action_unfocus(union ActionData
*data
);
241 void action_iconify(union ActionData
*data
);
243 void action_focus_order_to_bottom(union ActionData
*data
);
245 void action_raiselower(union ActionData
*data
);
247 void action_raise(union ActionData
*data
);
249 void action_lower(union ActionData
*data
);
251 void action_close(union ActionData
*data
);
253 void action_kill(union ActionData
*data
);
255 void action_shade(union ActionData
*data
);
257 void action_shadelower(union ActionData
*data
);
259 void action_unshaderaise(union ActionData
*data
);
261 void action_unshade(union ActionData
*data
);
263 void action_toggle_shade(union ActionData
*data
);
265 void action_toggle_omnipresent(union ActionData
*data
);
266 /* MoveResizeRelative */
267 void action_move_relative_horz(union ActionData
*data
);
268 /* MoveResizeRelative */
269 void action_move_relative_vert(union ActionData
*data
);
270 /* MoveResizeRelative */
271 void action_move_relative(union ActionData
*data
);
272 /* MoveResizeRelative */
273 void action_resize_relative(union ActionData
*data
);
275 void action_move_to_center(union ActionData
*data
);
276 /* MoveResizeRelative */
277 void action_resize_relative_horz(union ActionData
*data
);
278 /* MoveResizeRelative */
279 void action_resize_relative_vert(union ActionData
*data
);
281 void action_maximize_full(union ActionData
*data
);
283 void action_unmaximize_full(union ActionData
*data
);
285 void action_toggle_maximize_full(union ActionData
*data
);
287 void action_maximize_horz(union ActionData
*data
);
289 void action_unmaximize_horz(union ActionData
*data
);
291 void action_toggle_maximize_horz(union ActionData
*data
);
293 void action_maximize_vert(union ActionData
*data
);
295 void action_unmaximize_vert(union ActionData
*data
);
297 void action_toggle_maximize_vert(union ActionData
*data
);
299 void action_toggle_fullscreen(union ActionData
*data
);
301 void action_send_to_desktop(union ActionData
*data
);
302 /* SendToDesktopDirection */
303 void action_send_to_desktop_dir(union ActionData
*data
);
305 void action_desktop(union ActionData
*data
);
306 /* DesktopDirection */
307 void action_desktop_dir(union ActionData
*data
);
309 void action_desktop_last(union ActionData
*data
);
311 void action_toggle_decorations(union ActionData
*data
);
313 void action_moveresize(union ActionData
*data
);
315 void action_reconfigure(union ActionData
*data
);
317 void action_restart(union ActionData
*data
);
319 void action_exit(union ActionData
*data
);
321 void action_showmenu(union ActionData
*data
);
323 void action_cycle_windows(union ActionData
*data
);
324 /* InterDirectionalAction */
325 void action_directional_focus(union ActionData
*data
);
326 /* DirectionalAction */
327 void action_movetoedge(union ActionData
*data
);
328 /* DirectionalAction */
329 void action_growtoedge(union ActionData
*data
);
331 void action_send_to_layer(union ActionData
*data
);
333 void action_toggle_layer(union ActionData
*data
);
335 void action_toggle_dockautohide(union ActionData
*data
);
337 void action_toggle_show_desktop(union ActionData
*data
);
339 void action_show_desktop(union ActionData
*data
);
341 void action_unshow_desktop(union ActionData
*data
);