]> Dogcows Code - chaz/openbox/blob - openbox/client.h
add a mwm.h for the mwm hint structure and flags.
[chaz/openbox] / openbox / client.h
1 #ifndef __client_h
2 #define __client_h
3
4 #include "misc.h"
5 #include "mwm.h"
6 #include "geom.h"
7 #include "stacking.h"
8 #include "render/color.h"
9
10 #include <glib.h>
11 #include <X11/Xlib.h>
12
13 struct Frame;
14 struct Group;
15
16 /* The value in client.transient_for indicating it is a transient for its
17 group instead of for a single window */
18 #define TRAN_GROUP ((void*)~0l)
19
20 /*! Holds an icon in ARGB format */
21 typedef struct Icon {
22 int width, height;
23 RrPixel32 *data;
24 } Icon;
25
26 /*! Possible window types */
27 typedef enum {
28 Type_Desktop, /*!< A desktop (bottom-most window) */
29 Type_Dock, /*!< A dock bar/panel window */
30 Type_Toolbar, /*!< A toolbar window, pulled off an app */
31 Type_Menu, /*!< An unpinned menu from an app */
32 Type_Utility, /*!< A small utility window such as a palette */
33 Type_Splash, /*!< A splash screen window */
34 Type_Dialog, /*!< A dialog window */
35 Type_Normal /*!< A normal application window */
36 } WindowType;
37
38 /*! The things the user can do to the client window */
39 typedef enum {
40 Func_Resize = 1 << 0, /*!< Allow resizing */
41 Func_Move = 1 << 1, /*!< Allow moving */
42 Func_Iconify = 1 << 2, /*!< Allow to be iconified */
43 Func_Maximize = 1 << 3, /*!< Allow to be maximized */
44 Func_Shade = 1 << 4, /*!< Allow to be shaded */
45 Func_Fullscreen = 1 << 5, /*!< Allow to be made fullscreen */
46 Func_Close = 1 << 6 /*!< Allow to be closed */
47 } Function;
48
49 /*! The decorations the client window wants to be displayed on it */
50 typedef enum {
51 Decor_Titlebar = 1 << 0, /*!< Display a titlebar */
52 Decor_Handle = 1 << 1, /*!< Display a handle (bottom) */
53 Decor_Border = 1 << 2, /*!< Display a border */
54 Decor_Icon = 1 << 3, /*!< Display the window's icon */
55 Decor_Iconify = 1 << 4, /*!< Display an iconify button */
56 Decor_Maximize = 1 << 5, /*!< Display a maximize button */
57 /*! Display a button to toggle the window's placement on
58 all desktops */
59 Decor_AllDesktops = 1 << 6,
60 Decor_Shade = 1 << 7, /*!< Displays a shade button */
61 Decor_Close = 1 << 8 /*!< Display a close button */
62 } Decoration;
63
64 typedef struct Client {
65 ObWindow obwin;
66
67 Window window;
68
69 /*! The window's decorations. NULL while the window is being managed! */
70 struct Frame *frame;
71
72 /*! The number of unmap events to ignore on the window */
73 int ignore_unmaps;
74
75 /*! The id of the group the window belongs to */
76 struct Group *group;
77 /*! Whether or not the client is a transient window. This is guaranteed to
78 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
79 transient_for == NULL. */
80 gboolean transient;
81 /*! The client which this client is a transient (child) for.
82 A value of TRAN_GROUP signifies that the window is a transient for all
83 members of its Group, and is not a valid pointer to be followed in this
84 case.
85 */
86 struct Client *transient_for;
87 /*! The clients which are transients (children) of this client */
88 GSList *transients;
89 /*! The desktop on which the window resides (0xffffffff for all
90 desktops) */
91 guint desktop;
92
93 /*! Normal window title */
94 gchar *title;
95 /*! The count for the title. When another window with the same title
96 exists, a count will be appended to it. */
97 guint title_count;
98 /*! Window title when iconified */
99 gchar *icon_title;
100
101 /*! The application that created the window */
102 gchar *name;
103 /*! The class of the window, can used for grouping */
104 gchar *class;
105 /*! The specified role of the window, used for identification */
106 gchar *role;
107
108 /*! The type of window (what its function is) */
109 WindowType type;
110
111 /*! Position and size of the window
112 This will not always be the actual position of the window on screen, it
113 is, rather, the position requested by the client, to which the window's
114 gravity is applied.
115 */
116 Rect area;
117
118 /*! The window's strut
119 The strut defines areas of the screen that are marked off-bounds for
120 window placement. In theory, where this window exists.
121 */
122 Strut strut;
123
124 /*! The logical size of the window
125 The "logical" size of the window is refers to the user's perception of
126 the size of the window, and is the value that should be displayed to the
127 user. For example, with xterms, this value it the number of characters
128 being displayed in the terminal, instead of the number of pixels.
129 */
130 Size logical_size;
131
132 /*! Width of the border on the window.
133 The window manager will set this to 0 while the window is being managed,
134 but needs to restore it afterwards, so it is saved here.
135 */
136 guint border_width;
137
138 /*! The minimum aspect ratio the client window can be sized to.
139 A value of 0 means this is ignored.
140 */
141 float min_ratio;
142 /*! The maximum aspect ratio the client window can be sized to.
143 A value of 0 means this is ignored.
144 */
145 float max_ratio;
146
147 /*! The minimum size of the client window
148 If the min is > the max, then the window is not resizable
149 */
150 Size min_size;
151 /*! The maximum size of the client window
152 If the min is > the max, then the window is not resizable
153 */
154 Size max_size;
155 /*! The size of increments to resize the client window by */
156 Size size_inc;
157 /*! The base size of the client window
158 This value should be subtracted from the window's actual size when
159 displaying its size to the user, or working with its min/max size
160 */
161 Size base_size;
162
163 /*! Window decoration and functionality hints */
164 ObMwmHints mwmhints;
165
166 /*! Where to place the decorated window in relation to the undecorated
167 window */
168 int gravity;
169
170 /*! The state of the window, one of WithdrawnState, IconicState, or
171 NormalState */
172 long wmstate;
173
174 /*! True if the client supports the delete_window protocol */
175 gboolean delete_window;
176
177 /*! Was the window's position requested by the application? if not, we
178 should place the window ourselves when it first appears */
179 gboolean positioned;
180
181 /*! Can the window receive input focus? */
182 gboolean can_focus;
183 /*! Urgency flag */
184 gboolean urgent;
185 /*! Notify the window when it receives focus? */
186 gboolean focus_notify;
187
188 /*! The window uses shape extension to be non-rectangular? */
189 gboolean shaped;
190
191 /*! The window is modal, so it must be processed before any windows it is
192 related to can be focused */
193 gboolean modal;
194 /*! Only the window's titlebar is displayed */
195 gboolean shaded;
196 /*! The window is iconified */
197 gboolean iconic;
198 /*! The window is maximized to fill the screen vertically */
199 gboolean max_vert;
200 /*! The window is maximized to fill the screen horizontally */
201 gboolean max_horz;
202 /*! The window should not be displayed by pagers */
203 gboolean skip_pager;
204 /*! The window should not be displayed by taskbars */
205 gboolean skip_taskbar;
206 /*! The window is a 'fullscreen' window, and should be on top of all
207 others */
208 gboolean fullscreen;
209 /*! The window should be on top of other windows of the same type.
210 above takes priority over below. */
211 gboolean above;
212 /*! The window should be underneath other windows of the same type.
213 above takes priority over below. */
214 gboolean below;
215
216 /*! The layer in which the window will be stacked, windows in lower layers
217 are always below windows in higher layers. */
218 StackLayer layer;
219
220 /*! A bitmask of values in the Decoration enum
221 The values in the variable are the decorations that the client wants to
222 be displayed around it.
223 */
224 int decorations;
225
226 /*! A bitmask of values in the Decoration enum.
227 Specifies the decorations that should NOT be displayed on the client.
228 */
229 int disabled_decorations;
230
231 /*! A bitmask of values in the Function enum
232 The values in the variable specify the ways in which the user is allowed
233 to modify this window.
234 */
235 int functions;
236
237 /*! Icons for the client as specified on the client window */
238 Icon *icons;
239 /*! The number of icons in icons */
240 int nicons;
241 } Client;
242
243 extern GList *client_list;
244
245 void client_startup();
246 void client_shutdown();
247
248 /*! Manages all existing windows */
249 void client_manage_all();
250 /*! Manages a given window */
251 void client_manage(Window win);
252 /*! Unmanages all managed windows */
253 void client_unmanage_all();
254 /*! Unmanages a given client */
255 void client_unmanage(Client *client);
256
257 /*! Sets the client list on the root window from the client_list */
258 void client_set_list();
259
260 /*! Determines if the client should be shown or hidden currently.
261 @return TRUE if it should be visible; otherwise, FALSE.
262 */
263 gboolean client_should_show(Client *self);
264
265 /*! Returns if the window should be treated as a normal window.
266 Some windows (desktops, docks, splash screens) have special rules applied
267 to them in a number of places regarding focus or user interaction. */
268 gboolean client_normal(Client *self);
269
270 /* Returns if the window is focused */
271 gboolean client_focused(Client *self);
272
273 /*! Move and/or resize the window.
274 This also maintains things like the client's minsize, and size increments.
275 @param anchor The corner to keep in the same position when resizing.
276 @param x The x coordiante of the new position for the client.
277 @param y The y coordiante of the new position for the client.
278 @param w The width component of the new size for the client.
279 @param h The height component of the new size for the client.
280 @param user Specifies whether this is a user-requested change or a
281 program requested change. For program requested changes, the
282 constraints are not checked.
283 @param final If user is true, then this should specify if this is a final
284 configuration. e.g. Final should be FALSE if doing an
285 interactive move/resize, and then be TRUE for the last call
286 only.
287 */
288 void client_configure(Client *self, ObCorner anchor,
289 int x, int y, int w, int h,
290 gboolean user, gboolean final);
291
292 void client_reconfigure(Client *self);
293
294 /*! Moves a client so that it is on screen if it is entirely out of the
295 viewable screen.
296 */
297 void client_move_onscreen(Client *self);
298
299 /*! Fullscreen's or unfullscreen's the client window
300 @param fs true if the window should be made fullscreen; false if it should
301 be returned to normal state.
302 @param savearea true to have the client's current size and position saved;
303 otherwise, they are not. You should not save when mapping a
304 new window that is set to fullscreen. This has no effect
305 when restoring a window from fullscreen.
306 */
307 void client_fullscreen(Client *self, gboolean fs, gboolean savearea);
308
309 /*! Iconifies or uniconifies the client window
310 @param iconic true if the window should be iconified; false if it should be
311 restored.
312 @param curdesk If iconic is FALSE, then this determines if the window will
313 be uniconified to the current viewable desktop (true) or to
314 its previous desktop (false)
315 */
316 void client_iconify(Client *self, gboolean iconic, gboolean curdesk);
317
318 /*! Maximize or unmaximize the client window
319 @param max true if the window should be maximized; false if it should be
320 returned to normal size.
321 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
322 @param savearea true to have the client's current size and position saved;
323 otherwise, they are not. You should not save when mapping a
324 new window that is set to fullscreen. This has no effect
325 when unmaximizing a window.
326 */
327 void client_maximize(Client *self, gboolean max, int dir,
328 gboolean savearea);
329
330 /*! Shades or unshades the client window
331 @param shade true if the window should be shaded; false if it should be
332 unshaded.
333 */
334 void client_shade(Client *self, gboolean shade);
335
336 /*! Request the client to close its window */
337 void client_close(Client *self);
338
339 /*! Kill the client off violently */
340 void client_kill(Client *self);
341
342 /*! Sends the window to the specified desktop
343 @param donthide If TRUE, the window will not be shown/hidden after its
344 desktop has been changed. Generally this should be FALSE. */
345 void client_set_desktop(Client *self, guint target, gboolean donthide);
346
347 /*! Validate client, by making sure no Destroy or Unmap events exist in
348 the event queue for the window.
349 @return true if the client is valid; false if the client has already
350 been unmapped/destroyed, and so is invalid.
351 */
352 gboolean client_validate(Client *self);
353
354 /*! Sets the wm_state to the specified value */
355 void client_set_wm_state(Client *self, long state);
356
357 /*! Adjusts the window's net_state
358 This should not be called as part of the window mapping process! It is for
359 use when updating the state post-mapping.<br>
360 client_apply_startup_state is used to do the same things during the mapping
361 process.
362 */
363 void client_set_state(Client *self, Atom action, long data1, long data2);
364
365 /* Given a Client, find the client that focus would actually be sent to if
366 you wanted to give focus to the specified Client. Will return the same
367 Client passed to it or another Client if appropriate. */
368 Client *client_focus_target(Client *self);
369
370 /*! Returns what client_focus would return if passed the same client, but
371 without focusing it or modifying the focus order lists. */
372 gboolean client_can_focus(Client *self);
373
374 /*! Attempt to focus the client window */
375 gboolean client_focus(Client *self);
376
377 /*! Remove focus from the client window */
378 void client_unfocus(Client *self);
379
380 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
381 when the user deliberately selects a window for use. */
382 void client_activate(Client *self);
383
384 /*! Calculates the stacking layer for the client window */
385 void client_calc_layer(Client *self);
386
387 /*! Updates the window's transient status, and any parents of it */
388 void client_update_transient_for(Client *self);
389 /*! Update the protocols that the window supports and adjusts things if they
390 change */
391 void client_update_protocols(Client *self);
392 /*! Updates the WMNormalHints and adjusts things if they change */
393 void client_update_normal_hints(Client *self);
394
395 /*! Updates the WMHints and adjusts things if they change
396 @param initstate Whether to read the initial_state property from the
397 WMHints. This should only be used during the mapping
398 process.
399 */
400 void client_update_wmhints(Client *self);
401 /*! Updates the window's title and icon title */
402 void client_update_title(Client *self);
403 /*! Updates the window's application name and class */
404 void client_update_class(Client *self);
405 /*! Updates the strut for the client */
406 void client_update_strut(Client *self);
407 /*! Updates the window's icons */
408 void client_update_icons(Client *self);
409
410 /*! Set up what decor should be shown on the window and what functions should
411 be allowed (Client::decorations and Client::functions).
412 This also updates the NET_WM_ALLOWED_ACTIONS hint.
413 */
414 void client_setup_decor_and_functions(Client *self);
415
416 /*! Retrieves the window's type and sets Client->type */
417 void client_get_type(Client *self);
418
419 Icon *client_icon(Client *self, int w, int h);
420
421 /*! Searches a client's transients for a focused window. The function does not
422 check for the passed client, only for its transients.
423 If no focused transient is found, NULL is returned.
424 */
425 Client *client_search_focus_tree(Client *self);
426
427 /*! Searches a client's transient tree for a focused window. The function
428 searches up the tree and down other branches as well as the passed client's.
429 If no focused client is found, NULL is returned.
430 */
431 Client *client_search_focus_tree_full(Client *self);
432
433 /*! Return a modal child of the client window that can be focused.
434 @return A modal child of the client window that can be focused, or 0 if
435 none was found.
436 */
437 Client *client_search_modal_child(Client *self);
438
439 Client *client_search_top_transient(Client *self);
440
441 /*! Return the "closest" client in the given direction */
442 Client *client_find_directional(Client *c, ObDirection dir);
443
444 /*! Set a client window to be above/below other clients.
445 @layer < 0 indicates the client should be placed below other clients.<br>
446 = 0 indicates the client should be placed with other clients.<br>
447 > 0 indicates the client should be placed above other clients.
448 */
449 void client_set_layer(Client *self, int layer);
450
451 guint client_monitor(Client *self);
452
453 #endif
This page took 0.057001 seconds and 4 git commands to generate.