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