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