]> icculus.org git repositories - dana/openbox.git/blob - openbox/action.h
fix grabbing and not releasing with menus
[dana/openbox.git] / openbox / action.h
1 #ifndef __action_h
2 #define __action_h
3
4 #include "misc.h"
5 #include "parser/parse.h"
6
7 typedef struct _ObAction ObAction;
8
9 /* These have to all have a Client* at the top even if they don't use it, so
10    that I can set it blindly later on. So every function will have a Client*
11    available (possibly NULL though) if it wants it.
12 */
13
14 struct AnyAction {
15     struct _ObClient *c;
16 };
17
18 struct DirectionalAction{
19     struct _ObClient *c;
20     ObDirection direction;
21 };
22
23 struct Execute {
24     struct _ObClient *c;
25     char *path;
26 };
27
28 struct ClientAction {
29     struct _ObClient *c;
30 };
31
32 struct Activate {
33     struct _ObClient *c;
34     gboolean here; /* bring it to the current desktop */
35 };
36
37 struct MoveResizeRelative {
38     struct _ObClient *c;
39     int delta;
40 };
41
42 struct SendToDesktop {
43     struct _ObClient *c;
44     guint desk;
45     gboolean follow;
46 };
47
48 struct SendToDesktopDirection {
49     struct _ObClient *c;
50     ObDirection dir;
51     gboolean wrap;
52     gboolean linear;
53     gboolean final;
54     gboolean cancel;
55     gboolean follow;
56 };
57
58 struct Desktop {
59     struct _ObClient *c;
60     guint desk;
61 };
62
63 struct Layer {
64     struct _ObClient *c;
65     int layer; /* < 0 = below, 0 = normal, > 0 = above */
66 };
67
68 struct DesktopDirection {
69     struct _ObClient *c;
70     ObDirection dir;
71     gboolean wrap;
72     gboolean linear;
73     gboolean final;
74     gboolean cancel;
75 };
76
77 struct MoveResize {
78     struct _ObClient *c;
79     int x;
80     int y;
81     guint32 corner; /* prop_atoms.net_wm_moveresize_* */
82     guint button;
83 };
84
85 struct ShowMenu {
86     struct _ObClient *c;
87     char *name;
88     int x;
89     int y;
90 };
91
92 struct CycleWindows {
93     struct _ObClient *c;
94     gboolean linear;
95     gboolean forward;
96     gboolean final;
97     gboolean cancel;
98 };
99
100 union ActionData {
101     struct AnyAction any;
102     struct DirectionalAction diraction;
103     struct Execute execute;
104     struct ClientAction client;
105     struct Activate activate;
106     struct MoveResizeRelative relative;
107     struct SendToDesktop sendto;
108     struct SendToDesktopDirection sendtodir;
109     struct Desktop desktop;
110     struct DesktopDirection desktopdir;
111     struct MoveResize moveresize;
112     struct ShowMenu showmenu;
113     struct CycleWindows cycle;
114     struct Layer layer;
115 };
116
117 struct _ObAction {
118     /* The func member acts like an enum to tell which one of the structs in
119        the data union are valid.
120     */
121     void (*func)(union ActionData *data);
122     union ActionData data;
123 };
124
125 ObAction *action_new(void (*func)(union ActionData *data));
126
127 /* Creates a new Action from the name of the action
128    A few action types need data set after making this call still. Check if
129    the returned action's "func" is one of these.
130    action_execute - the path needs to be set
131    action_restart - the path can optionally be set
132    action_desktop - the destination desktop needs to be set
133    action_move_relative_horz - the delta
134    action_move_relative_vert - the delta
135    action_resize_relative_horz - the delta
136    action_resize_relative_vert - the delta
137 */
138
139 ObAction *action_from_string(char *name);
140 ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
141 void action_free(ObAction *a);
142
143 /* Execute */
144 void action_execute(union ActionData *data);
145 /* ActivateAction */
146 void action_activate(union ActionData *data);
147 /* ClientAction */
148 void action_focus(union ActionData *data);
149 /* ClientAction */
150 void action_unfocus(union ActionData *data);
151 /* ClientAction */
152 void action_iconify(union ActionData *data);
153 /* ClientAction */
154 void action_raiselower(union ActionData *data);
155 /* ClientAction */
156 void action_raise(union ActionData *data);
157 /* ClientAction */
158 void action_lower(union ActionData *data);
159 /* ClientAction */
160 void action_close(union ActionData *data);
161 /* ClientAction */
162 void action_kill(union ActionData *data);
163 /* ClientAction */
164 void action_shade(union ActionData *data);
165 /* ClientAction */
166 void action_shadelower(union ActionData *data);
167 /* ClientAction */
168 void action_unshaderaise(union ActionData *data);
169 /* ClientAction */
170 void action_unshade(union ActionData *data);
171 /* ClientAction */
172 void action_toggle_shade(union ActionData *data);
173 /* ClientAction */
174 void action_toggle_omnipresent(union ActionData *data);
175 /* MoveResizeRelative */
176 void action_move_relative_horz(union ActionData *data);
177 /* MoveResizeRelative */
178 void action_move_relative_vert(union ActionData *data);
179 /* MoveResizeRelative */
180 void action_resize_relative_horz(union ActionData *data);
181 /* MoveResizeRelative */
182 void action_resize_relative_vert(union ActionData *data);
183 /* ClientAction */
184 void action_maximize_full(union ActionData *data);
185 /* ClientAction */
186 void action_unmaximize_full(union ActionData *data);
187 /* ClientAction */
188 void action_toggle_maximize_full(union ActionData *data);
189 /* ClientAction */
190 void action_maximize_horz(union ActionData *data);
191 /* ClientAction */
192 void action_unmaximize_horz(union ActionData *data);
193 /* ClientAction */
194 void action_toggle_maximize_horz(union ActionData *data);
195 /* ClientAction */
196 void action_maximize_vert(union ActionData *data);
197 /* ClientAction */
198 void action_unmaximize_vert(union ActionData *data);
199 /* ClientAction */
200 void action_toggle_maximize_vert(union ActionData *data);
201 /* SendToDesktop */
202 void action_send_to_desktop(union ActionData *data);
203 /* SendToDesktopDirection */
204 void action_send_to_desktop_dir(union ActionData *data);
205 /* Desktop */
206 void action_desktop(union ActionData *data);
207 /* DesktopDirection */
208 void action_desktop_dir(union ActionData *data);
209 /* ClientAction */
210 void action_toggle_decorations(union ActionData *data);
211 /* MoveResize */
212 void action_moveresize(union ActionData *data);
213 /* Execute */
214 void action_restart(union ActionData *data);
215 /* Any */
216 void action_exit(union ActionData *data);
217 /* ShowMenu */
218 void action_showmenu(union ActionData *data);
219 /* CycleWindows */
220 void action_cycle_windows(union ActionData *data);
221 /* DirectionalAction */
222 void action_directional_focus(union ActionData *data);
223 /* DirectionalAction */
224 void action_movetoedge(union ActionData *data);
225 /* DirectionalAction */
226 void action_growtoedge(union ActionData *data);
227 /* Layer */
228 void action_send_to_layer(union ActionData *data);
229 /* Layer */
230 void action_toggle_layer(union ActionData *data);
231 /* Any */
232 void action_toggle_show_desktop(union ActionData *data);
233 /* Any */
234 void action_show_desktop(union ActionData *data);
235 /* Any */
236 void action_unshow_desktop(union ActionData *data);
237
238 #endif