8 #include "render/color.h"
16 typedef struct _ObClient ObClient;
17 typedef struct _ObClientIcon ObClientIcon;
19 /* The value in client.transient_for indicating it is a transient for its
20 group instead of for a single window */
21 #define TRAN_GROUP ((void*)~0l)
23 /*! Holds an icon in ARGB format */
31 /*! Possible window types */
33 Type_Desktop, /*!< A desktop (bottom-most window) */
34 Type_Dock, /*!< A dock bar/panel window */
35 Type_Toolbar, /*!< A toolbar window, pulled off an app */
36 Type_Menu, /*!< An unpinned menu from an app */
37 Type_Utility, /*!< A small utility window such as a palette */
38 Type_Splash, /*!< A splash screen window */
39 Type_Dialog, /*!< A dialog window */
40 Type_Normal /*!< A normal application window */
43 /*! The things the user can do to the client window */
45 Func_Resize = 1 << 0, /*!< Allow resizing */
46 Func_Move = 1 << 1, /*!< Allow moving */
47 Func_Iconify = 1 << 2, /*!< Allow to be iconified */
48 Func_Maximize = 1 << 3, /*!< Allow to be maximized */
49 Func_Shade = 1 << 4, /*!< Allow to be shaded */
50 Func_Fullscreen = 1 << 5, /*!< Allow to be made fullscreen */
51 Func_Close = 1 << 6 /*!< Allow to be closed */
54 /*! The decorations the client window wants to be displayed on it */
56 Decor_Titlebar = 1 << 0, /*!< Display a titlebar */
57 Decor_Handle = 1 << 1, /*!< Display a handle (bottom) */
58 Decor_Border = 1 << 2, /*!< Display a border */
59 Decor_Icon = 1 << 3, /*!< Display the window's icon */
60 Decor_Iconify = 1 << 4, /*!< Display an iconify button */
61 Decor_Maximize = 1 << 5, /*!< Display a maximize button */
62 /*! Display a button to toggle the window's placement on
64 Decor_AllDesktops = 1 << 6,
65 Decor_Shade = 1 << 7, /*!< Displays a shade button */
66 Decor_Close = 1 << 8 /*!< Display a close button */
75 /*! The window's decorations. NULL while the window is being managed! */
78 /*! The number of unmap events to ignore on the window */
81 /*! The id of the group the window belongs to */
83 /*! Whether or not the client is a transient window. This is guaranteed to
84 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
85 transient_for == NULL. */
87 /*! The client which this client is a transient (child) for.
88 A value of TRAN_GROUP signifies that the window is a transient for all
89 members of its Group, and is not a valid pointer to be followed in this
92 ObClient *transient_for;
93 /*! The clients which are transients (children) of this client */
95 /*! The desktop on which the window resides (0xffffffff for all
99 /*! Normal window title */
101 /*! The count for the title. When another window with the same title
102 exists, a count will be appended to it. */
104 /*! Window title when iconified */
107 /*! The application that created the window */
109 /*! The class of the window, can used for grouping */
111 /*! The specified role of the window, used for identification */
114 /*! The type of window (what its function is) */
117 /*! Position and size of the window
118 This will not always be the actual position of the window on screen, it
119 is, rather, the position requested by the client, to which the window's
124 /*! The window's strut
125 The strut defines areas of the screen that are marked off-bounds for
126 window placement. In theory, where this window exists.
130 /*! The logical size of the window
131 The "logical" size of the window is refers to the user's perception of
132 the size of the window, and is the value that should be displayed to the
133 user. For example, with xterms, this value it the number of characters
134 being displayed in the terminal, instead of the number of pixels.
138 /*! Width of the border on the window.
139 The window manager will set this to 0 while the window is being managed,
140 but needs to restore it afterwards, so it is saved here.
144 /*! The minimum aspect ratio the client window can be sized to.
145 A value of 0 means this is ignored.
148 /*! The maximum aspect ratio the client window can be sized to.
149 A value of 0 means this is ignored.
153 /*! The minimum size of the client window
154 If the min is > the max, then the window is not resizable
157 /*! The maximum size of the client window
158 If the min is > the max, then the window is not resizable
161 /*! The size of increments to resize the client window by */
163 /*! The base size of the client window
164 This value should be subtracted from the window's actual size when
165 displaying its size to the user, or working with its min/max size
169 /*! Window decoration and functionality hints */
172 /*! Where to place the decorated window in relation to the undecorated
176 /*! The state of the window, one of WithdrawnState, IconicState, or
180 /*! True if the client supports the delete_window protocol */
181 gboolean delete_window;
183 /*! Was the window's position requested by the application? if not, we
184 should place the window ourselves when it first appears */
187 /*! Can the window receive input focus? */
191 /*! Notify the window when it receives focus? */
192 gboolean focus_notify;
194 /*! The window uses shape extension to be non-rectangular? */
197 /*! The window is modal, so it must be processed before any windows it is
198 related to can be focused */
200 /*! Only the window's titlebar is displayed */
202 /*! The window is iconified */
204 /*! The window is maximized to fill the screen vertically */
206 /*! The window is maximized to fill the screen horizontally */
208 /*! The window should not be displayed by pagers */
210 /*! The window should not be displayed by taskbars */
211 gboolean skip_taskbar;
212 /*! The window is a 'fullscreen' window, and should be on top of all
215 /*! The window should be on top of other windows of the same type.
216 above takes priority over below. */
218 /*! The window should be underneath other windows of the same type.
219 above takes priority over below. */
222 /*! The layer in which the window will be stacked, windows in lower layers
223 are always below windows in higher layers. */
226 /*! A bitmask of values in the Decoration enum
227 The values in the variable are the decorations that the client wants to
228 be displayed around it.
232 /*! A bitmask of values in the Decoration enum.
233 Specifies the decorations that should NOT be displayed on the client.
235 int disabled_decorations;
237 /*! A bitmask of values in the Function enum
238 The values in the variable specify the ways in which the user is allowed
239 to modify this window.
243 /*! Icons for the client as specified on the client window */
245 /*! The number of icons in icons */
249 extern GList *client_list;
251 void client_startup();
252 void client_shutdown();
254 /*! Manages all existing windows */
255 void client_manage_all();
256 /*! Manages a given window */
257 void client_manage(Window win);
258 /*! Unmanages all managed windows */
259 void client_unmanage_all();
260 /*! Unmanages a given client */
261 void client_unmanage(ObClient *client);
263 /*! Sets the client list on the root window from the client_list */
264 void client_set_list();
266 /*! Determines if the client should be shown or hidden currently.
267 @return TRUE if it should be visible; otherwise, FALSE.
269 gboolean client_should_show(ObClient *self);
271 /*! Returns if the window should be treated as a normal window.
272 Some windows (desktops, docks, splash screens) have special rules applied
273 to them in a number of places regarding focus or user interaction. */
274 gboolean client_normal(ObClient *self);
276 /* Returns if the window is focused */
277 gboolean client_focused(ObClient *self);
279 /*! Move and/or resize the window.
280 This also maintains things like the client's minsize, and size increments.
281 @param anchor The corner to keep in the same position when resizing.
282 @param x The x coordiante of the new position for the client.
283 @param y The y coordiante of the new position for the client.
284 @param w The width component of the new size for the client.
285 @param h The height component of the new size for the client.
286 @param user Specifies whether this is a user-requested change or a
287 program requested change. For program requested changes, the
288 constraints are not checked.
289 @param final If user is true, then this should specify if this is a final
290 configuration. e.g. Final should be FALSE if doing an
291 interactive move/resize, and then be TRUE for the last call
294 void client_configure(ObClient *self, ObCorner anchor,
295 int x, int y, int w, int h,
296 gboolean user, gboolean final);
298 void client_reconfigure(ObClient *self);
300 /*! Moves a client so that it is on screen if it is entirely out of the
303 void client_move_onscreen(ObClient *self);
305 /*! Fullscreen's or unfullscreen's the client window
306 @param fs true if the window should be made fullscreen; false if it should
307 be returned to normal state.
308 @param savearea true to have the client's current size and position saved;
309 otherwise, they are not. You should not save when mapping a
310 new window that is set to fullscreen. This has no effect
311 when restoring a window from fullscreen.
313 void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea);
315 /*! Iconifies or uniconifies the client window
316 @param iconic true if the window should be iconified; false if it should be
318 @param curdesk If iconic is FALSE, then this determines if the window will
319 be uniconified to the current viewable desktop (true) or to
320 its previous desktop (false)
322 void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk);
324 /*! Maximize or unmaximize the client window
325 @param max true if the window should be maximized; false if it should be
326 returned to normal size.
327 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
328 @param savearea true to have the client's current size and position saved;
329 otherwise, they are not. You should not save when mapping a
330 new window that is set to fullscreen. This has no effect
331 when unmaximizing a window.
333 void client_maximize(ObClient *self, gboolean max, int dir,
336 /*! Shades or unshades the client window
337 @param shade true if the window should be shaded; false if it should be
340 void client_shade(ObClient *self, gboolean shade);
342 /*! Request the client to close its window */
343 void client_close(ObClient *self);
345 /*! Kill the client off violently */
346 void client_kill(ObClient *self);
348 /*! Sends the window to the specified desktop
349 @param donthide If TRUE, the window will not be shown/hidden after its
350 desktop has been changed. Generally this should be FALSE. */
351 void client_set_desktop(ObClient *self, guint target, gboolean donthide);
353 /*! Validate client, by making sure no Destroy or Unmap events exist in
354 the event queue for the window.
355 @return true if the client is valid; false if the client has already
356 been unmapped/destroyed, and so is invalid.
358 gboolean client_validate(ObClient *self);
360 /*! Sets the wm_state to the specified value */
361 void client_set_wm_state(ObClient *self, long state);
363 /*! Adjusts the window's net_state
364 This should not be called as part of the window mapping process! It is for
365 use when updating the state post-mapping.<br>
366 client_apply_startup_state is used to do the same things during the mapping
369 void client_set_state(ObClient *self, Atom action, long data1, long data2);
371 /* Given a ObClient, find the client that focus would actually be sent to if
372 you wanted to give focus to the specified ObClient. Will return the same
373 ObClient passed to it or another ObClient if appropriate. */
374 ObClient *client_focus_target(ObClient *self);
376 /*! Returns what client_focus would return if passed the same client, but
377 without focusing it or modifying the focus order lists. */
378 gboolean client_can_focus(ObClient *self);
380 /*! Attempt to focus the client window */
381 gboolean client_focus(ObClient *self);
383 /*! Remove focus from the client window */
384 void client_unfocus(ObClient *self);
386 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
387 when the user deliberately selects a window for use. */
388 void client_activate(ObClient *self);
390 /*! Calculates the stacking layer for the client window */
391 void client_calc_layer(ObClient *self);
393 /*! Updates the window's transient status, and any parents of it */
394 void client_update_transient_for(ObClient *self);
395 /*! Update the protocols that the window supports and adjusts things if they
397 void client_update_protocols(ObClient *self);
398 /*! Updates the WMNormalHints and adjusts things if they change */
399 void client_update_normal_hints(ObClient *self);
401 /*! Updates the WMHints and adjusts things if they change
402 @param initstate Whether to read the initial_state property from the
403 WMHints. This should only be used during the mapping
406 void client_update_wmhints(ObClient *self);
407 /*! Updates the window's title and icon title */
408 void client_update_title(ObClient *self);
409 /*! Updates the window's application name and class */
410 void client_update_class(ObClient *self);
411 /*! Updates the strut for the client */
412 void client_update_strut(ObClient *self);
413 /*! Updates the window's icons */
414 void client_update_icons(ObClient *self);
416 /*! Set up what decor should be shown on the window and what functions should
417 be allowed (ObClient::decorations and ObClient::functions).
418 This also updates the NET_WM_ALLOWED_ACTIONS hint.
420 void client_setup_decor_and_functions(ObClient *self);
422 /*! Retrieves the window's type and sets ObClient->type */
423 void client_get_type(ObClient *self);
425 ObClientIcon *client_icon(ObClient *self, int w, int h);
427 /*! Searches a client's transients for a focused window. The function does not
428 check for the passed client, only for its transients.
429 If no focused transient is found, NULL is returned.
431 ObClient *client_search_focus_tree(ObClient *self);
433 /*! Searches a client's transient tree for a focused window. The function
434 searches up the tree and down other branches as well as the passed client's.
435 If no focused client is found, NULL is returned.
437 ObClient *client_search_focus_tree_full(ObClient *self);
439 /*! Return a modal child of the client window that can be focused.
440 @return A modal child of the client window that can be focused, or 0 if
443 ObClient *client_search_modal_child(ObClient *self);
445 ObClient *client_search_top_transient(ObClient *self);
447 /*! Return the "closest" client in the given direction */
448 ObClient *client_find_directional(ObClient *c, ObDirection dir);
450 /*! Set a client window to be above/below other clients.
451 @layer < 0 indicates the client should be placed below other clients.<br>
452 = 0 indicates the client should be placed with other clients.<br>
453 > 0 indicates the client should be placed above other clients.
455 void client_set_layer(ObClient *self, int layer);
457 guint client_monitor(ObClient *self);