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