]> Dogcows Code - chaz/openbox/blob - openbox/action.h
Add MoveFromEdge* actions, shorten client_directional_edge_search with some handy...
[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 Ben 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 };
52
53 struct InteractiveAction {
54 struct AnyAction any;
55 gboolean final;
56 gboolean cancel;
57 };
58
59 struct InterDirectionalAction{
60 struct InteractiveAction inter;
61 ObDirection direction;
62 gboolean dialog;
63 };
64
65 struct DirectionalAction{
66 struct AnyAction any;
67 ObDirection direction;
68 gboolean hang;
69 };
70
71 struct Execute {
72 struct AnyAction any;
73 gchar *path;
74 };
75
76 struct ClientAction {
77 struct AnyAction any;
78 };
79
80 struct Activate {
81 struct AnyAction any;
82 gboolean here; /* bring it to the current desktop */
83 };
84
85 struct MoveResizeRelative {
86 struct AnyAction any;
87 gint deltax;
88 gint deltay;
89 gint deltaxl;
90 gint deltayu;
91 };
92
93 struct SendToDesktop {
94 struct AnyAction any;
95 guint desk;
96 gboolean follow;
97 };
98
99 struct SendToDesktopDirection {
100 struct InteractiveAction inter;
101 ObDirection dir;
102 gboolean wrap;
103 gboolean linear;
104 gboolean follow;
105 };
106
107 struct Desktop {
108 struct InteractiveAction inter;
109 guint desk;
110 };
111
112 struct Layer {
113 struct AnyAction any;
114 gint layer; /* < 0 = below, 0 = normal, > 0 = above */
115 };
116
117 struct DesktopDirection {
118 struct InteractiveAction inter;
119 ObDirection dir;
120 gboolean wrap;
121 gboolean linear;
122 };
123
124 struct MoveResize {
125 struct AnyAction any;
126 gboolean move;
127 gboolean keyboard;
128 };
129
130 struct ShowMenu {
131 struct AnyAction any;
132 gchar *name;
133 };
134
135 struct CycleWindows {
136 struct InteractiveAction inter;
137 gboolean linear;
138 gboolean forward;
139 gboolean dialog;
140 };
141
142 struct Stacking {
143 struct AnyAction any;
144 gboolean group;
145 };
146
147 union ActionData {
148 struct AnyAction any;
149 struct InteractiveAction inter;
150 struct InterDirectionalAction interdiraction;
151 struct DirectionalAction diraction;
152 struct Execute execute;
153 struct ClientAction client;
154 struct Activate activate;
155 struct MoveResizeRelative relative;
156 struct SendToDesktop sendto;
157 struct SendToDesktopDirection sendtodir;
158 struct Desktop desktop;
159 struct DesktopDirection desktopdir;
160 struct MoveResize moveresize;
161 struct ShowMenu showmenu;
162 struct CycleWindows cycle;
163 struct Layer layer;
164 struct Stacking stacking;
165 };
166
167 struct _ObAction {
168 guint ref;
169
170 /* The func member acts like an enum to tell which one of the structs in
171 the data union are valid.
172 */
173 void (*func)(union ActionData *data);
174 union ActionData data;
175 };
176
177 /* Creates a new Action from the name of the action
178 A few action types need data set after making this call still. Check if
179 the returned action's "func" is one of these.
180 action_execute - the path needs to be set
181 action_restart - the path can optionally be set
182 action_desktop - the destination desktop needs to be set
183 action_send_to_desktop - the destination desktop needs to be set
184 action_move_relative_horz - the delta
185 action_move_relative_vert - the delta
186 action_resize_relative_horz - the delta
187 action_resize_relative_vert - the delta
188 action_move_relative - the deltas
189 action_resize_relative - the deltas
190 */
191
192 ObAction* action_from_string(const gchar *name, ObUserAction uact);
193 ObAction* action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
194 ObUserAction uact);
195 void action_ref(ObAction *a);
196 void action_unref(ObAction *a);
197
198 ObAction* action_copy(const ObAction *a);
199
200 /*! Executes a list of actions.
201 @param c The client associated with the action. Can be NULL.
202 @param state The keyboard modifiers state at the time the user action occured
203 @param button The mouse button used to execute the action.
204 @param x The x coord at which the user action occured.
205 @param y The y coord at which the user action occured.
206 @param cancel If the action is cancelling an interactive action. This only
207 affects interactive actions, but should generally always be FALSE.
208 @param done If the action is completing an interactive action. This only
209 affects interactive actions, but should generally always be FALSE.
210 */
211 void action_run_list(GSList *acts, struct _ObClient *c, ObFrameContext context,
212 guint state, guint button, gint x, gint y,
213 gboolean cancel, gboolean done);
214
215 #define action_run_mouse(a, c, n, s, b, x, y) \
216 action_run_list(a, c, n, s, b, x, y, FALSE, FALSE)
217
218 #define action_run_interactive(a, c, s, n, d) \
219 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, n, d)
220
221 #define action_run_key(a, c, s, x, y) \
222 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE, FALSE)
223
224 #define action_run(a, c, s) \
225 action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE, FALSE)
226
227 void action_run_string(const gchar *name, struct _ObClient *c);
228
229 /* Execute */
230 void action_execute(union ActionData *data);
231 /* ActivateAction */
232 void action_activate(union ActionData *data);
233 /* ClientAction */
234 void action_focus(union ActionData *data);
235 /* ClientAction */
236 void action_unfocus(union ActionData *data);
237 /* ClientAction */
238 void action_iconify(union ActionData *data);
239 /* ClientAction */
240 void action_focus_order_to_bottom(union ActionData *data);
241 /* ClientAction */
242 void action_raiselower(union ActionData *data);
243 /* ClientAction */
244 void action_raise(union ActionData *data);
245 /* ClientAction */
246 void action_lower(union ActionData *data);
247 /* ClientAction */
248 void action_close(union ActionData *data);
249 /* ClientAction */
250 void action_kill(union ActionData *data);
251 /* ClientAction */
252 void action_shade(union ActionData *data);
253 /* ClientAction */
254 void action_shadelower(union ActionData *data);
255 /* ClientAction */
256 void action_unshaderaise(union ActionData *data);
257 /* ClientAction */
258 void action_unshade(union ActionData *data);
259 /* ClientAction */
260 void action_toggle_shade(union ActionData *data);
261 /* ClientAction */
262 void action_toggle_omnipresent(union ActionData *data);
263 /* MoveResizeRelative */
264 void action_move_relative_horz(union ActionData *data);
265 /* MoveResizeRelative */
266 void action_move_relative_vert(union ActionData *data);
267 /* MoveResizeRelative */
268 void action_move_relative(union ActionData *data);
269 /* MoveResizeRelative */
270 void action_resize_relative(union ActionData *data);
271 /* ClientAction */
272 void action_move_to_center(union ActionData *data);
273 /* MoveResizeRelative */
274 void action_resize_relative_horz(union ActionData *data);
275 /* MoveResizeRelative */
276 void action_resize_relative_vert(union ActionData *data);
277 /* ClientAction */
278 void action_maximize_full(union ActionData *data);
279 /* ClientAction */
280 void action_unmaximize_full(union ActionData *data);
281 /* ClientAction */
282 void action_toggle_maximize_full(union ActionData *data);
283 /* ClientAction */
284 void action_maximize_horz(union ActionData *data);
285 /* ClientAction */
286 void action_unmaximize_horz(union ActionData *data);
287 /* ClientAction */
288 void action_toggle_maximize_horz(union ActionData *data);
289 /* ClientAction */
290 void action_maximize_vert(union ActionData *data);
291 /* ClientAction */
292 void action_unmaximize_vert(union ActionData *data);
293 /* ClientAction */
294 void action_toggle_maximize_vert(union ActionData *data);
295 /* ClientAction */
296 void action_toggle_fullscreen(union ActionData *data);
297 /* SendToDesktop */
298 void action_send_to_desktop(union ActionData *data);
299 /* SendToDesktopDirection */
300 void action_send_to_desktop_dir(union ActionData *data);
301 /* Desktop */
302 void action_desktop(union ActionData *data);
303 /* DesktopDirection */
304 void action_desktop_dir(union ActionData *data);
305 /* Any */
306 void action_desktop_last(union ActionData *data);
307 /* ClientAction */
308 void action_toggle_decorations(union ActionData *data);
309 /* MoveResize */
310 void action_moveresize(union ActionData *data);
311 /* Any */
312 void action_reconfigure(union ActionData *data);
313 /* Execute */
314 void action_restart(union ActionData *data);
315 /* Any */
316 void action_exit(union ActionData *data);
317 /* ShowMenu */
318 void action_showmenu(union ActionData *data);
319 /* CycleWindows */
320 void action_cycle_windows(union ActionData *data);
321 /* InterDirectionalAction */
322 void action_directional_focus(union ActionData *data);
323 /* DirectionalAction */
324 void action_movetoedge(union ActionData *data);
325 /* DirectionalAction */
326 void action_growtoedge(union ActionData *data);
327 /* Layer */
328 void action_send_to_layer(union ActionData *data);
329 /* Layer */
330 void action_toggle_layer(union ActionData *data);
331 /* Any */
332 void action_toggle_dockautohide(union ActionData *data);
333 /* Any */
334 void action_toggle_show_desktop(union ActionData *data);
335 /* Any */
336 void action_show_desktop(union ActionData *data);
337 /* Any */
338 void action_unshow_desktop(union ActionData *data);
339
340 #endif
This page took 0.046051 seconds and 4 git commands to generate.