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