]> icculus.org git repositories - dana/openbox.git/blob - openbox/action.h
handle focus in the kernel, no more plugin
[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 Execute {
16     Client *c;
17     char *path;
18 };
19
20 struct ClientAction {
21     Client *c;
22 };
23
24 struct MoveResizeRelative {
25     Client *c;
26     int delta;
27 };
28
29 struct SendToDesktop {
30     Client *c;
31     guint desktop;
32 };
33
34 struct SendToNextPreviousDesktop {
35     Client *c;
36     gboolean wrap;
37     gboolean follow;
38 };
39
40 struct Desktop {
41     Client *c;
42     guint desk;
43 };
44
45 struct NextPreviousDesktop {
46     Client *c;
47     gboolean wrap;
48 };
49
50 struct Move {
51     Client *c;
52     int x;
53     int y;
54     gboolean final;
55 };
56
57 struct Resize {
58     Client *c;
59     int x;
60     int y;
61     gboolean final;
62     Corner corner;
63 };
64
65 union ActionData {
66     struct AnyAction any;
67     struct Execute execute;
68     struct ClientAction client;
69     struct MoveResizeRelative relative;
70     struct SendToDesktop sendto;
71     struct SendToNextPreviousDesktop sendtonextprev;
72     struct Desktop desktop;
73     struct NextPreviousDesktop nextprevdesktop;
74     struct Move move;
75     struct Resize resize;
76 };
77
78 typedef struct {
79     /* The func member acts like an enum to tell which one of the structs in
80        the data union are valid.
81     */
82     void (*func)(union ActionData *data);
83     union ActionData data;
84 } Action;
85
86 Action *action_new(void (*func)(union ActionData *data));
87
88 /* Creates a new Action from the name of the action
89    A few action types need data set after making this call still. Check if
90    the returned action's "func" is one of these.
91    action_execute - the path needs to be set
92    action_restart - the path can optionally be set
93    action_desktop - the destination desktop needs to be set
94    action_move_relative_horz - the delta
95    action_move_relative_vert - the delta
96    action_resize_relative_horz - the delta
97    action_resize_relative_vert - the delta
98 */
99 Action *action_from_string(char *name);
100 void action_free(Action *a);
101
102 /* Execute */
103 void action_execute(union ActionData *data);
104 /* ClientAction */
105 void action_focus(union ActionData *data);
106 /* ClientAction */
107 void action_unfocus(union ActionData *data);
108 /* ClientAction */
109 void action_iconify(union ActionData *data);
110 /* ClientAction */
111 void action_raise(union ActionData *data);
112 /* ClientAction */
113 void action_lower(union ActionData *data);
114 /* ClientAction */
115 void action_focusraise(union ActionData *data);
116 /* ClientAction */
117 void action_close(union ActionData *data);
118 /* ClientAction */
119 void action_kill(union ActionData *data);
120 /* ClientAction */
121 void action_shade(union ActionData *data);
122 /* ClientAction */
123 void action_unshade(union ActionData *data);
124 /* ClientAction */
125 void action_toggle_shade(union ActionData *data);
126 /* ClientAction */
127 void action_toggle_omnipresent(union ActionData *data);
128 /* MoveResizeRelative */
129 void action_move_relative_horz(union ActionData *data);
130 /* MoveResizeRelative */
131 void action_move_relative_vert(union ActionData *data);
132 /* MoveResizeRelative */
133 void action_resize_relative_horz(union ActionData *data);
134 /* MoveResizeRelative */
135 void action_resize_relative_vert(union ActionData *data);
136 /* ClientAction */
137 void action_maximize_full(union ActionData *data);
138 /* ClientAction */
139 void action_unmaximize_full(union ActionData *data);
140 /* ClientAction */
141 void action_toggle_maximize_full(union ActionData *data);
142 /* ClientAction */
143 void action_maximize_horz(union ActionData *data);
144 /* ClientAction */
145 void action_unmaximize_horz(union ActionData *data);
146 /* ClientAction */
147 void action_toggle_maximize_horz(union ActionData *data);
148 /* ClientAction */
149 void action_maximize_vert(union ActionData *data);
150 /* ClientAction */
151 void action_unmaximize_vert(union ActionData *data);
152 /* ClientAction */
153 void action_toggle_maximize_vert(union ActionData *data);
154 /* SendToDesktop */
155 void action_send_to_desktop(union ActionData *data);
156 /* SendToNextPreviousDesktop */
157 void action_send_to_next_desktop(union ActionData *data);
158 /* SendToNextPreviousDesktop */
159 void action_send_to_previous_desktop(union ActionData *data);
160 /* Desktop */
161 void action_desktop(union ActionData *data);
162 /* NextPreviousDesktop */
163 void action_next_desktop(union ActionData *data);
164 /* NextPreviousDesktop */
165 void action_previous_desktop(union ActionData *data);
166 /* NextPreviousDesktop */
167 void action_next_desktop_column(union ActionData *data);
168 /* NextPreviousDesktop */
169 void action_previous_desktop_column(union ActionData *data);
170 /* NextPreviousDesktop */
171 void action_next_desktop_row(union ActionData *data);
172 /* NextPreviousDesktop */
173 void action_previous_desktop_row(union ActionData *data);
174 /* ClientAction */
175 void action_toggle_decorations(union ActionData *data);
176 /* Move */
177 void action_move(union ActionData *data);
178 /* Resize */
179 void action_resize(union ActionData *data);
180 /* Execute */
181 void action_restart(union ActionData *data);
182 /* Any */
183 void action_exit(union ActionData *data);
184
185 #endif