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