]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/action.h
dont grab client context stuff on desktop windows. check that clint is non-null
[mikachu/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 };
56
57 struct Desktop {
58     struct _ObClient *c;
59     guint desk;
60 };
61
62 struct Layer {
63     struct _ObClient *c;
64     int layer; /* < 0 = below, 0 = normal, > 0 = above */
65 };
66
67 struct DesktopDirection {
68     struct _ObClient *c;
69     ObDirection dir;
70     gboolean wrap;
71     gboolean linear;
72     gboolean final;
73     gboolean cancel;
74 };
75
76 struct MoveResize {
77     struct _ObClient *c;
78     int x;
79     int y;
80     guint32 corner; /* prop_atoms.net_wm_moveresize_* */
81     guint button;
82 };
83
84 struct ShowMenu {
85     struct _ObClient *c;
86     char *name;
87     int x;
88     int y;
89 };
90
91 struct CycleWindows {
92     struct _ObClient *c;
93     gboolean linear;
94     gboolean forward;
95     gboolean final;
96     gboolean cancel;
97 };
98
99 union ActionData {
100     struct AnyAction any;
101     struct DirectionalAction diraction;
102     struct Execute execute;
103     struct ClientAction client;
104     struct Activate activate;
105     struct MoveResizeRelative relative;
106     struct SendToDesktop sendto;
107     struct SendToDesktopDirection sendtodir;
108     struct Desktop desktop;
109     struct DesktopDirection desktopdir;
110     struct MoveResize moveresize;
111     struct ShowMenu showmenu;
112     struct CycleWindows cycle;
113     struct Layer layer;
114 };
115
116 struct _ObAction {
117     /* The func member acts like an enum to tell which one of the structs in
118        the data union are valid.
119     */
120     void (*func)(union ActionData *data);
121     union ActionData data;
122 };
123
124 ObAction *action_new(void (*func)(union ActionData *data));
125
126 /* Creates a new Action from the name of the action
127    A few action types need data set after making this call still. Check if
128    the returned action's "func" is one of these.
129    action_execute - the path needs to be set
130    action_restart - the path can optionally be set
131    action_desktop - the destination desktop needs to be set
132    action_move_relative_horz - the delta
133    action_move_relative_vert - the delta
134    action_resize_relative_horz - the delta
135    action_resize_relative_vert - the delta
136 */
137
138 ObAction *action_from_string(char *name);
139 ObAction *action_parse(xmlDocPtr doc, xmlNodePtr node);
140 void action_free(ObAction *a);
141
142 /* Execute */
143 void action_execute(union ActionData *data);
144 /* ActivateAction */
145 void action_activate(union ActionData *data);
146 /* ClientAction */
147 void action_focus(union ActionData *data);
148 /* ClientAction */
149 void action_unfocus(union ActionData *data);
150 /* ClientAction */
151 void action_iconify(union ActionData *data);
152 /* ClientAction */
153 void action_raise(union ActionData *data);
154 /* ClientAction */
155 void action_lower(union ActionData *data);
156 /* ClientAction */
157 void action_close(union ActionData *data);
158 /* ClientAction */
159 void action_kill(union ActionData *data);
160 /* ClientAction */
161 void action_shade(union ActionData *data);
162 /* ClientAction */
163 void action_shadelower(union ActionData *data);
164 /* ClientAction */
165 void action_unshaderaise(union ActionData *data);
166 /* ClientAction */
167 void action_unshade(union ActionData *data);
168 /* ClientAction */
169 void action_toggle_shade(union ActionData *data);
170 /* ClientAction */
171 void action_toggle_omnipresent(union ActionData *data);
172 /* MoveResizeRelative */
173 void action_move_relative_horz(union ActionData *data);
174 /* MoveResizeRelative */
175 void action_move_relative_vert(union ActionData *data);
176 /* MoveResizeRelative */
177 void action_resize_relative_horz(union ActionData *data);
178 /* MoveResizeRelative */
179 void action_resize_relative_vert(union ActionData *data);
180 /* ClientAction */
181 void action_maximize_full(union ActionData *data);
182 /* ClientAction */
183 void action_unmaximize_full(union ActionData *data);
184 /* ClientAction */
185 void action_toggle_maximize_full(union ActionData *data);
186 /* ClientAction */
187 void action_maximize_horz(union ActionData *data);
188 /* ClientAction */
189 void action_unmaximize_horz(union ActionData *data);
190 /* ClientAction */
191 void action_toggle_maximize_horz(union ActionData *data);
192 /* ClientAction */
193 void action_maximize_vert(union ActionData *data);
194 /* ClientAction */
195 void action_unmaximize_vert(union ActionData *data);
196 /* ClientAction */
197 void action_toggle_maximize_vert(union ActionData *data);
198 /* SendToDesktop */
199 void action_send_to_desktop(union ActionData *data);
200 /* SendToDesktopDirection */
201 void action_send_to_desktop_dir(union ActionData *data);
202 /* Desktop */
203 void action_desktop(union ActionData *data);
204 /* DesktopDirection */
205 void action_desktop_dir(union ActionData *data);
206 /* ClientAction */
207 void action_toggle_decorations(union ActionData *data);
208 /* MoveResize */
209 void action_moveresize(union ActionData *data);
210 /* Execute */
211 void action_restart(union ActionData *data);
212 /* Any */
213 void action_exit(union ActionData *data);
214 /* ShowMenu */
215 void action_showmenu(union ActionData *data);
216 /* CycleWindows */
217 void action_cycle_windows(union ActionData *data);
218 /* DirectionalAction */
219 void action_directional_focus(union ActionData *data);
220 /* DirectionalAction */
221 void action_movetoedge(union ActionData *data);
222 /* DirectionalAction */
223 void action_growtoedge(union ActionData *data);
224 /* Layer */
225 void action_send_to_layer(union ActionData *data);
226 /* Layer */
227 void action_toggle_layer(union ActionData *data);
228 /* Any */
229 void action_toggle_show_desktop(union ActionData *data);
230 /* Any */
231 void action_show_desktop(union ActionData *data);
232 /* Any */
233 void action_unshow_desktop(union ActionData *data);
234
235 #endif