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