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.
38 OB_CLIENT_ACTION_OPTIONAL
,
39 OB_CLIENT_ACTION_ALWAYS
43 ObClientActionReq client_action
;
45 ObFrameContext context
;
52 struct InteractiveAction
{
58 struct InterDirectionalAction
{
59 struct InteractiveAction inter
;
60 ObDirection direction
;
64 struct DirectionalAction
{
66 ObDirection direction
;
80 gboolean here
; /* bring it to the current desktop */
83 struct MoveResizeRelative
{
88 struct SendToDesktop
{
94 struct SendToDesktopDirection
{
95 struct InteractiveAction inter
;
103 struct InteractiveAction inter
;
108 struct AnyAction any
;
109 gint layer
; /* < 0 = below, 0 = normal, > 0 = above */
112 struct DesktopDirection
{
113 struct InteractiveAction inter
;
120 struct AnyAction any
;
126 struct AnyAction any
;
130 struct CycleWindows
{
131 struct InteractiveAction inter
;
138 struct AnyAction any
;
139 struct InteractiveAction inter
;
140 struct InterDirectionalAction interdiraction
;
141 struct DirectionalAction diraction
;
142 struct Execute execute
;
143 struct ClientAction client
;
144 struct Activate activate
;
145 struct MoveResizeRelative relative
;
146 struct SendToDesktop sendto
;
147 struct SendToDesktopDirection sendtodir
;
148 struct Desktop desktop
;
149 struct DesktopDirection desktopdir
;
150 struct MoveResize moveresize
;
151 struct ShowMenu showmenu
;
152 struct CycleWindows cycle
;
159 /* The func member acts like an enum to tell which one of the structs in
160 the data union are valid.
162 void (*func
)(union ActionData
*data
);
163 union ActionData data
;
166 /* Creates a new Action from the name of the action
167 A few action types need data set after making this call still. Check if
168 the returned action's "func" is one of these.
169 action_execute - the path needs to be set
170 action_restart - the path can optionally be set
171 action_desktop - the destination desktop needs to be set
172 action_send_to_desktop - the destination desktop needs to be set
173 action_move_relative_horz - the delta
174 action_move_relative_vert - the delta
175 action_resize_relative_horz - the delta
176 action_resize_relative_vert - the delta
179 ObAction
* action_from_string(const gchar
*name
, ObUserAction uact
);
180 ObAction
* action_parse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
182 void action_ref(ObAction
*a
);
183 void action_unref(ObAction
*a
);
185 ObAction
* action_copy(const ObAction
*a
);
187 /*! Executes a list of actions.
188 @param c The client associated with the action. Can be NULL.
189 @param state The keyboard modifiers state at the time the user action occured
190 @param button The mouse button used to execute the action.
191 @param x The x coord at which the user action occured.
192 @param y The y coord at which the user action occured.
193 @param cancel If the action is cancelling an interactive action. This only
194 affects interactive actions, but should generally always be FALSE.
195 @param done If the action is completing an interactive action. This only
196 affects interactive actions, but should generally always be FALSE.
198 void action_run_list(GSList
*acts
, struct _ObClient
*c
, ObFrameContext context
,
199 guint state
, guint button
, gint x
, gint y
,
200 gboolean cancel
, gboolean done
);
202 #define action_run_mouse(a, c, n, s, b, x, y) \
203 action_run_list(a, c, n, s, b, x, y, FALSE, FALSE)
205 #define action_run_interactive(a, c, s, n, d) \
206 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, n, d)
208 #define action_run_key(a, c, s, x, y) \
209 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE, FALSE)
211 #define action_run(a, c, s) \
212 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE, FALSE)
214 void action_run_string(const gchar
*name
, struct _ObClient
*c
);
217 void action_execute(union ActionData
*data
);
219 void action_activate(union ActionData
*data
);
221 void action_focus(union ActionData
*data
);
223 void action_unfocus(union ActionData
*data
);
225 void action_iconify(union ActionData
*data
);
227 void action_raiselower(union ActionData
*data
);
229 void action_raise(union ActionData
*data
);
231 void action_lower(union ActionData
*data
);
233 void action_close(union ActionData
*data
);
235 void action_kill(union ActionData
*data
);
237 void action_shade(union ActionData
*data
);
239 void action_shadelower(union ActionData
*data
);
241 void action_unshaderaise(union ActionData
*data
);
243 void action_unshade(union ActionData
*data
);
245 void action_toggle_shade(union ActionData
*data
);
247 void action_toggle_omnipresent(union ActionData
*data
);
248 /* MoveResizeRelative */
249 void action_move_relative_horz(union ActionData
*data
);
250 /* MoveResizeRelative */
251 void action_move_relative_vert(union ActionData
*data
);
252 /* MoveResizeRelative */
253 void action_resize_relative_horz(union ActionData
*data
);
254 /* MoveResizeRelative */
255 void action_resize_relative_vert(union ActionData
*data
);
257 void action_maximize_full(union ActionData
*data
);
259 void action_unmaximize_full(union ActionData
*data
);
261 void action_toggle_maximize_full(union ActionData
*data
);
263 void action_maximize_horz(union ActionData
*data
);
265 void action_unmaximize_horz(union ActionData
*data
);
267 void action_toggle_maximize_horz(union ActionData
*data
);
269 void action_maximize_vert(union ActionData
*data
);
271 void action_unmaximize_vert(union ActionData
*data
);
273 void action_toggle_maximize_vert(union ActionData
*data
);
275 void action_send_to_desktop(union ActionData
*data
);
276 /* SendToDesktopDirection */
277 void action_send_to_desktop_dir(union ActionData
*data
);
279 void action_desktop(union ActionData
*data
);
280 /* DesktopDirection */
281 void action_desktop_dir(union ActionData
*data
);
283 void action_desktop_last(union ActionData
*data
);
285 void action_toggle_decorations(union ActionData
*data
);
287 void action_moveresize(union ActionData
*data
);
289 void action_reconfigure(union ActionData
*data
);
291 void action_restart(union ActionData
*data
);
293 void action_exit(union ActionData
*data
);
295 void action_showmenu(union ActionData
*data
);
297 void action_cycle_windows(union ActionData
*data
);
298 /* InterDirectionalAction */
299 void action_directional_focus(union ActionData
*data
);
300 /* DirectionalAction */
301 void action_movetoedge(union ActionData
*data
);
302 /* DirectionalAction */
303 void action_growtoedge(union ActionData
*data
);
305 void action_send_to_layer(union ActionData
*data
);
307 void action_toggle_layer(union ActionData
*data
);
309 void action_toggle_show_desktop(union ActionData
*data
);
311 void action_show_desktop(union ActionData
*data
);
313 void action_unshow_desktop(union ActionData
*data
);