]> Dogcows Code - chaz/openbox/blob - c/client.h
merge the C branch into HEAD
[chaz/openbox] / c / client.h
1 #ifndef __client_h
2 #define __client_h
3
4 #include "geom.h"
5 #include "obexport.h"
6 #include <glib.h>
7 #include <X11/Xlib.h>
8
9 struct ClientWrap;
10 struct Frame;
11
12
13 /*! Holds an icon in ARGB format */
14 typedef struct Icon {
15 unsigned long w, h;
16 unsigned long *data;
17 } Icon;
18
19 /*! The MWM Hints as retrieved from the window property
20 This structure only contains 3 elements, even though the Motif 2.0
21 structure contains 5. We only use the first 3, so that is all gets
22 defined.
23 */
24 typedef struct MwmHints {
25 /*! A bitmask of Client::MwmFlags values */
26 unsigned long flags;
27 /*! A bitmask of Client::MwmFunctions values */
28 unsigned long functions;
29 /*! A bitmask of Client::MwmDecorations values */
30 unsigned long decorations;
31 } MwmHints;
32 /*! The number of elements in the Client::MwmHints struct */
33 #define MWM_ELEMENTS 3
34
35 /*! Possible flags for MWM Hints (defined by Motif 2.0) */
36 typedef enum {
37 MwmFlag_Functions = 1 << 0, /*!< The MMW Hints define funcs */
38 MwmFlag_Decorations = 1 << 1 /*!< The MWM Hints define decor */
39 } MwmFlags;
40
41 /*! Possible functions for MWM Hints (defined by Motif 2.0) */
42 typedef enum {
43 MwmFunc_All = 1 << 0, /*!< All functions */
44 MwmFunc_Resize = 1 << 1, /*!< Allow resizing */
45 MwmFunc_Move = 1 << 2, /*!< Allow moving */
46 MwmFunc_Iconify = 1 << 3, /*!< Allow to be iconfied */
47 MwmFunc_Maximize = 1 << 4 /*!< Allow to be maximized */
48 /*MwmFunc_Close = 1 << 5 /!< Allow to be closed */
49 } MwmFunctions;
50
51 /*! Possible decorations for MWM Hints (defined by Motif 2.0) */
52 typedef enum {
53 MwmDecor_All = 1 << 0, /*!< All decorations */
54 MwmDecor_Border = 1 << 1, /*!< Show a border */
55 MwmDecor_Handle = 1 << 2, /*!< Show a handle (bottom) */
56 MwmDecor_Title = 1 << 3, /*!< Show a titlebar */
57 /*MwmDecor_Menu = 1 << 4, /!< Show a menu */
58 MwmDecor_Iconify = 1 << 5, /*!< Show an iconify button */
59 MwmDecor_Maximize = 1 << 6 /*!< Show a maximize button */
60 } MemDecorations;
61
62
63 typedef struct Client {
64 Window window;
65
66 struct Frame *frame;
67
68 /*! The number of unmap events to ignore on the window */
69 int ignore_unmaps;
70
71 /*! The id of the group the window belongs to */
72 Window group;
73 /*! Whether or not the client is a transient window. This is guaranteed to
74 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
75 transient_for == NULL. */
76 gboolean transient;
77 /*! The client which this client is a transient (child) for */
78 struct Client *transient_for;
79 /*! The clients which are transients (children) of this client */
80 GSList *transients;
81 /*! The desktop on which the window resides (0xffffffff for all
82 desktops) */
83 unsigned int desktop;
84
85 /*! Normal window title */
86 gchar *title;
87 /*! Window title when iconified */
88 gchar *icon_title;
89
90 /*! The application that created the window */
91 gchar *res_name;
92 /*! The class of the window, can used for grouping */
93 gchar *res_class;
94 /*! The specified role of the window, used for identification */
95 gchar *role;
96
97 /*! The type of window (what its function is) */
98 WindowType type;
99
100 /*! Position and size of the window
101 This will not always be the actual position of the window on screen, it
102 is, rather, the position requested by the client, to which the window's
103 gravity is applied.
104 */
105 Rect area;
106
107 /*! The window's strut
108 The strut defines areas of the screen that are marked off-bounds for
109 window placement. In theory, where this window exists.
110 */
111 Strut strut;
112
113 /*! The logical size of the window
114 The "logical" size of the window is refers to the user's perception of
115 the size of the window, and is the value that should be displayed to the
116 user. For example, with xterms, this value it the number of characters
117 being displayed in the terminal, instead of the number of pixels.
118 */
119 Size logical_size;
120
121 /*! Width of the border on the window.
122 The window manager will set this to 0 while the window is being managed,
123 but needs to restore it afterwards, so it is saved here.
124 */
125 guint border_width;
126
127 /*! The minimum aspect ratio the client window can be sized to.
128 A value of 0 means this is ignored.
129 */
130 float min_ratio;
131 /*! The maximum aspect ratio the client window can be sized to.
132 A value of 0 means this is ignored.
133 */
134 float max_ratio;
135
136 /*! The minimum size of the client window
137 If the min is > the max, then the window is not resizable
138 */
139 Size min_size;
140 /*! The maximum size of the client window
141 If the min is > the max, then the window is not resizable
142 */
143 Size max_size;
144 /*! The size of increments to resize the client window by */
145 Size size_inc;
146 /*! The base size of the client window
147 This value should be subtracted from the window's actual size when
148 displaying its size to the user, or working with its min/max size
149 */
150 Size base_size;
151
152 /*! Window decoration and functionality hints */
153 MwmHints mwmhints;
154
155 /*! Where to place the decorated window in relation to the undecorated
156 window */
157 int gravity;
158
159 /*! The state of the window, one of WithdrawnState, IconicState, or
160 NormalState */
161 long wmstate;
162
163 /*! True if the client supports the delete_window protocol */
164 gboolean delete_window;
165
166 /*! Was the window's position requested by the application? if not, we
167 should place the window ourselves when it first appears */
168 gboolean positioned;
169
170 /*! Can the window receive input focus? */
171 gboolean can_focus;
172 /*! Urgency flag */
173 gboolean urgent;
174 /*! Notify the window when it receives focus? */
175 gboolean focus_notify;
176 /*! Does the client window have the input focus? */
177 gboolean focused;
178
179 /*! The window uses shape extension to be non-rectangular? */
180 gboolean shaped;
181
182 /*! The window is modal, so it must be processed before any windows it is
183 related to can be focused */
184 gboolean modal;
185 /*! Only the window's titlebar is displayed */
186 gboolean shaded;
187 /*! The window is iconified */
188 gboolean iconic;
189 /*! The window is maximized to fill the screen vertically */
190 gboolean max_vert;
191 /*! The window is maximized to fill the screen horizontally */
192 gboolean max_horz;
193 /*! The window should not be displayed by pagers */
194 gboolean skip_pager;
195 /*! The window should not be displayed by taskbars */
196 gboolean skip_taskbar;
197 /*! The window is a 'fullscreen' window, and should be on top of all
198 others */
199 gboolean fullscreen;
200 /*! The window should be on top of other windows of the same type */
201 gboolean above;
202 /*! The window should be underneath other windows of the same type */
203 gboolean below;
204
205 /*! The layer in which the window will be stacked, windows in lower layers
206 are always below windows in higher layers. */
207 StackLayer layer;
208
209 /*! A bitmask of values in the Decoration enum
210 The values in the variable are the decorations that the client wants to
211 be displayed around it.
212 */
213 int decorations;
214
215 /*! A bitmask of values in the Decoration enum.
216 Specifies the decorations that should NOT be displayed on the client.
217 */
218 int disabled_decorations;
219
220 /*! A bitmask of values in the Function enum
221 The values in the variable specify the ways in which the user is allowed
222 to modify this window.
223 */
224 int functions;
225
226 /*! Icons for the client as specified on the client window */
227 Icon *icons;
228 /*! The number of icons in icons */
229 int nicons;
230
231 /*! The icon for the client specified in the WMHints or the KWM hints */
232 Pixmap pixmap_icon;
233 /*! The mask for the pixmap_icon, or None if its not masked */
234 Pixmap pixmap_icon_mask;
235
236 /* The instance of the wrapper class if one exists */
237 struct ClientWrap *wrap;
238 } Client;
239
240 extern GSList *client_list;
241 extern GHashTable *client_map;
242
243 void client_startup();
244 void client_shutdown();
245
246 /*! Manages all existing windows */
247 void client_manage_all();
248 /*! Manages a given window */
249 void client_manage(Window win);
250 /*! Unmanages all managed windows */
251 void client_unmanage_all();
252 /*! Unmanages a given client */
253 void client_unmanage(Client *client);
254
255 /*! Sets the client list on the root window from the client_list */
256 void client_set_list();
257
258 /*! Reapplies the maximized state to the window
259 Use this to make the window readjust its maximized size to new
260 surroundings (struts, etc). */
261 void client_remaximize(Client *self);
262
263 /*! Shows the window if it should be shown, or hides it
264 Used when changing desktops, the window's state, etc. */
265 void client_showhide(Client *self);
266
267 /*! Returns if the window should be treated as a normal window.
268 Some windows (desktops, docks, splash screens) have special rules applied
269 to them in a number of places regarding focus or user interaction. */
270 gboolean client_normal(Client *self);
271
272 /*! Internal version of the Client::resize function
273 This also maintains things like the client's minsize, and size increments.
274 @param anchor The corner to keep in the same position when resizing.
275 @param x The x coordiante of the new position for the client.
276 @param y The y coordiante of the new position for the client.
277 @param w The width component of the new size for the client.
278 @param h The height component of the new size for the client.
279 @param user Specifies whether this is a user-requested change or a
280 program requested change. For program requested changes, the
281 constraints are not checked.
282 @param final If user is true, then this should specify if this is a final
283 configuration. e.g. Final should be FALSE if doing an
284 interactive move/resize, and then be TRUE for the last call
285 only.
286 */
287 void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
288 gboolean user, gboolean final);
289
290 /*! Fullscreen's or unfullscreen's the client window
291 @param fs true if the window should be made fullscreen; false if it should
292 be returned to normal state.
293 @param savearea true to have the client's current size and position saved;
294 otherwise, they are not. You should not save when mapping a
295 new window that is set to fullscreen. This has no effect
296 when restoring a window from fullscreen.
297 */
298 void client_fullscreen(Client *self, gboolean fs, gboolean savearea);
299
300 /*! Iconifies or uniconifies the client window
301 @param iconic true if the window should be iconified; false if it should be
302 restored.
303 @param curdesk If iconic is FALSE, then this determines if the window will
304 be uniconified to the current viewable desktop (true) or to
305 its previous desktop (false)
306 */
307 void client_iconify(Client *self, gboolean iconic, gboolean curdesk);
308
309 /*! Maximize or unmaximize the client window
310 @param max true if the window should be maximized; false if it should be
311 returned to normal size.
312 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
313 @param savearea true to have the client's current size and position saved;
314 otherwise, they are not. You should not save when mapping a
315 new window that is set to fullscreen. This has no effect
316 when unmaximizing a window.
317 */
318 void client_maximize(Client *self, gboolean max, int dir,
319 gboolean savearea);
320
321 /*! Shades or unshades the client window
322 @param shade true if the window should be shaded; false if it should be
323 unshaded.
324 */
325 void client_shade(Client *self, gboolean shade);
326
327 /*! Request the client to close its window. */
328 void client_close(Client *self);
329
330 /*! Sends the window to the specified desktop */
331 void client_set_desktop(Client *self, unsigned int target);
332
333 /*! Return a modal child of the client window
334 @return A modal child of the client window, or 0 if none was found.
335 */
336 Client *client_find_modal_child(Client *self);
337
338 /*! Validate client, by making sure no Destroy or Unmap events exist in
339 the event queue for the window.
340 @return true if the client is valid; false if the client has already
341 been unmapped/destroyed, and so is invalid.
342 */
343 gboolean client_validate(Client *self);
344
345 /*! Sets the wm_state to the specified value */
346 void client_set_wm_state(Client *self, long state);
347
348 /*! Adjusts the window's net_state
349 This should not be called as part of the window mapping process! It is for
350 use when updating the state post-mapping.<br>
351 client_apply_startup_state is used to do the same things during the mapping
352 process.
353 */
354 void client_set_state(Client *self, Atom action, long data1, long data2);
355
356 /*! Attempt to focus the client window */
357 gboolean client_focus(Client *self);
358
359 /*! Remove focus from the client window */
360 void client_unfocus(Client *self);
361
362 /*! Calculates the stacking layer for the client window */
363 void client_calc_layer(Client *self);
364
365 /*! Updates the window's transient status, and any parents of it */
366 void client_update_transient_for(Client *self);
367 /*! Update the protocols that the window supports and adjusts things if they
368 change */
369 void client_update_protocols(Client *self);
370 /*! Updates the WMNormalHints and adjusts things if they change */
371 void client_update_normal_hints(Client *self);
372
373 /*! Updates the WMHints and adjusts things if they change
374 @param initstate Whether to read the initial_state property from the
375 WMHints. This should only be used during the mapping
376 process.
377 */
378 void client_update_wmhints(Client *self);
379 /*! Updates the window's title */
380 void client_update_title(Client *self);
381 /*! Updates the window's icon title */
382 void client_update_icon_title(Client *self);
383 /*! Updates the window's application name and class */
384 void client_update_class(Client *self);
385 /*! Updates the strut for the client */
386 void client_update_strut(Client *self);
387 /*! Updates the window's icons */
388 void client_update_icons(Client *self);
389 /*! Updates the window's kwm icon */
390 void client_update_kwm_icon(Client *self);
391
392 /*! Set up what decor should be shown on the window and what functions should
393 be allowed (Client::_decorations and Client::_functions).
394 This also updates the NET_WM_ALLOWED_ACTIONS hint.
395 */
396 void client_setup_decor_and_functions(Client *self);
397
398 /*! Retrieves the window's type and sets Client->type */
399 void client_get_type(Client *self);
400
401 #endif
This page took 0.050567 seconds and 4 git commands to generate.