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 OB_TRAN_GROUP ((void*)~0l)
23 /*! Holds an icon in ARGB format */
31 /*! Possible window types */
34 OB_CLIENT_TYPE_DESKTOP
, /*!< A desktop (bottom-most window) */
35 OB_CLIENT_TYPE_DOCK
, /*!< A dock bar/panel window */
36 OB_CLIENT_TYPE_TOOLBAR
, /*!< A toolbar window, pulled off an app */
37 OB_CLIENT_TYPE_MENU
, /*!< An unpinned menu from an app */
38 OB_CLIENT_TYPE_UTILITY
, /*!< A small utility window such as a palette */
39 OB_CLIENT_TYPE_SPLASH
, /*!< A splash screen window */
40 OB_CLIENT_TYPE_DIALOG
, /*!< A dialog window */
41 OB_CLIENT_TYPE_NORMAL
/*!< A normal application window */
44 /*! The things the user can do to the client window */
47 OB_CLIENT_FUNC_RESIZE
= 1 << 0, /*!< Allow user resizing */
48 OB_CLIENT_FUNC_MOVE
= 1 << 1, /*!< Allow user moving */
49 OB_CLIENT_FUNC_ICONIFY
= 1 << 2, /*!< Allow to be iconified */
50 OB_CLIENT_FUNC_MAXIMIZE
= 1 << 3, /*!< Allow to be maximized */
51 OB_CLIENT_FUNC_SHADE
= 1 << 4, /*!< Allow to be shaded */
52 OB_CLIENT_FUNC_FULLSCREEN
= 1 << 5, /*!< Allow to be made fullscreen */
53 OB_CLIENT_FUNC_CLOSE
= 1 << 6 /*!< Allow to be closed */
56 /*! The decorations the client window wants to be displayed on it */
58 Decor_Titlebar
= 1 << 0, /*!< Display a titlebar */
59 Decor_Handle
= 1 << 1, /*!< Display a handle (bottom) */
60 Decor_Border
= 1 << 2, /*!< Display a border */
61 Decor_Icon
= 1 << 3, /*!< Display the window's icon */
62 Decor_Iconify
= 1 << 4, /*!< Display an iconify button */
63 Decor_Maximize
= 1 << 5, /*!< Display a maximize button */
64 /*! Display a button to toggle the window's placement on
66 Decor_AllDesktops
= 1 << 6,
67 Decor_Shade
= 1 << 7, /*!< Displays a shade button */
68 Decor_Close
= 1 << 8 /*!< Display a close button */
77 /*! The window's decorations. NULL while the window is being managed! */
78 struct _ObFrame
*frame
;
80 /*! The number of unmap events to ignore on the window */
83 /*! The id of the group the window belongs to */
84 struct _ObGroup
*group
;
85 /*! Whether or not the client is a transient window. This is guaranteed to
86 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
87 transient_for == NULL. */
89 /*! The client which this client is a transient (child) for.
90 A value of TRAN_GROUP signifies that the window is a transient for all
91 members of its ObGroup, and is not a valid pointer to be followed in this
94 ObClient
*transient_for
;
95 /*! The clients which are transients (children) of this client */
97 /*! The desktop on which the window resides (0xffffffff for all
101 /*! Normal window title */
103 /*! The count for the title. When another window with the same title
104 exists, a count will be appended to it. */
106 /*! Window title when iconified */
109 /*! The application that created the window */
111 /*! The class of the window, can used for grouping */
113 /*! The specified role of the window, used for identification */
116 /*! The type of window (what its function is) */
119 /*! Position and size of the window
120 This will not always be the actual position of the window on screen, it
121 is, rather, the position requested by the client, to which the window's
126 /*! The window's strut
127 The strut defines areas of the screen that are marked off-bounds for
128 window placement. In theory, where this window exists.
132 /*! The logical size of the window
133 The "logical" size of the window is refers to the user's perception of
134 the size of the window, and is the value that should be displayed to the
135 user. For example, with xterms, this value it the number of characters
136 being displayed in the terminal, instead of the number of pixels.
140 /*! Width of the border on the window.
141 The window manager will set this to 0 while the window is being managed,
142 but needs to restore it afterwards, so it is saved here.
146 /*! The minimum aspect ratio the client window can be sized to.
147 A value of 0 means this is ignored.
150 /*! The maximum aspect ratio the client window can be sized to.
151 A value of 0 means this is ignored.
155 /*! The minimum size of the client window
156 If the min is > the max, then the window is not resizable
159 /*! The maximum size of the client window
160 If the min is > the max, then the window is not resizable
163 /*! The size of increments to resize the client window by */
165 /*! The base size of the client window
166 This value should be subtracted from the window's actual size when
167 displaying its size to the user, or working with its min/max size
171 /*! Window decoration and functionality hints */
174 /*! Where to place the decorated window in relation to the undecorated
178 /*! The state of the window, one of WithdrawnState, IconicState, or
182 /*! True if the client supports the delete_window protocol */
183 gboolean delete_window
;
185 /*! Was the window's position requested by the application? if not, we
186 should place the window ourselves when it first appears */
189 /*! Can the window receive input focus? */
193 /*! Notify the window when it receives focus? */
194 gboolean focus_notify
;
196 /*! The window uses shape extension to be non-rectangular? */
199 /*! The window is modal, so it must be processed before any windows it is
200 related to can be focused */
202 /*! Only the window's titlebar is displayed */
204 /*! The window is iconified */
206 /*! The window is maximized to fill the screen vertically */
208 /*! The window is maximized to fill the screen horizontally */
210 /*! The window should not be displayed by pagers */
212 /*! The window should not be displayed by taskbars */
213 gboolean skip_taskbar
;
214 /*! The window is a 'fullscreen' window, and should be on top of all
217 /*! The window should be on top of other windows of the same type.
218 above takes priority over below. */
220 /*! The window should be underneath other windows of the same type.
221 above takes priority over below. */
224 /*! The layer in which the window will be stacked, windows in lower layers
225 are always below windows in higher layers. */
228 /*! A bitmask of values in the Decoration enum
229 The values in the variable are the decorations that the client wants to
230 be displayed around it.
234 /*! A bitmask of values in the Decoration enum.
235 Specifies the decorations that should NOT be displayed on the client.
237 guint disabled_decorations
;
239 /*! A bitmask of values in the ObFunctions enum
240 The values in the variable specify the ways in which the user is allowed
241 to modify this window.
245 /*! Icons for the client as specified on the client window */
247 /*! The number of icons in icons */
251 extern GList
*client_list
;
253 void client_startup();
254 void client_shutdown();
256 /*! Manages all existing windows */
257 void client_manage_all();
258 /*! Manages a given window */
259 void client_manage(Window win
);
260 /*! Unmanages all managed windows */
261 void client_unmanage_all();
262 /*! Unmanages a given client */
263 void client_unmanage(ObClient
*client
);
265 /*! Sets the client list on the root window from the client_list */
266 void client_set_list();
268 /*! Determines if the client should be shown or hidden currently.
269 @return TRUE if it should be visible; otherwise, FALSE.
271 gboolean
client_should_show(ObClient
*self
);
273 /*! Returns if the window should be treated as a normal window.
274 Some windows (desktops, docks, splash screens) have special rules applied
275 to them in a number of places regarding focus or user interaction. */
276 gboolean
client_normal(ObClient
*self
);
278 /* Returns if the window is focused */
279 gboolean
client_focused(ObClient
*self
);
281 /*! Move and/or resize the window.
282 This also maintains things like the client's minsize, and size increments.
283 @param anchor The corner to keep in the same position when resizing.
284 @param x The x coordiante of the new position for the client.
285 @param y The y coordiante of the new position for the client.
286 @param w The width component of the new size for the client.
287 @param h The height component of the new size for the client.
288 @param user Specifies whether this is a user-requested change or a
289 program requested change. For program requested changes, the
290 constraints are not checked.
291 @param final If user is true, then this should specify if this is a final
292 configuration. e.g. Final should be FALSE if doing an
293 interactive move/resize, and then be TRUE for the last call
296 void client_configure(ObClient
*self
, ObCorner anchor
,
297 int x
, int y
, int w
, int h
,
298 gboolean user
, gboolean final
);
300 void client_reconfigure(ObClient
*self
);
302 /*! Moves a client so that it is on screen if it is entirely out of the
305 void client_move_onscreen(ObClient
*self
);
307 /*! Fullscreen's or unfullscreen's the client window
308 @param fs true if the window should be made fullscreen; false if it should
309 be returned to normal state.
310 @param savearea true to have the client's current size and position saved;
311 otherwise, they are not. You should not save when mapping a
312 new window that is set to fullscreen. This has no effect
313 when restoring a window from fullscreen.
315 void client_fullscreen(ObClient
*self
, gboolean fs
, gboolean savearea
);
317 /*! Iconifies or uniconifies the client window
318 @param iconic true if the window should be iconified; false if it should be
320 @param curdesk If iconic is FALSE, then this determines if the window will
321 be uniconified to the current viewable desktop (true) or to
322 its previous desktop (false)
324 void client_iconify(ObClient
*self
, gboolean iconic
, gboolean curdesk
);
326 /*! Maximize or unmaximize the client window
327 @param max true if the window should be maximized; false if it should be
328 returned to normal size.
329 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
330 @param savearea true to have the client's current size and position saved;
331 otherwise, they are not. You should not save when mapping a
332 new window that is set to fullscreen. This has no effect
333 when unmaximizing a window.
335 void client_maximize(ObClient
*self
, gboolean max
, int dir
,
338 /*! Shades or unshades the client window
339 @param shade true if the window should be shaded; false if it should be
342 void client_shade(ObClient
*self
, gboolean shade
);
344 /*! Request the client to close its window */
345 void client_close(ObClient
*self
);
347 /*! Kill the client off violently */
348 void client_kill(ObClient
*self
);
350 /*! Sends the window to the specified desktop
351 @param donthide If TRUE, the window will not be shown/hidden after its
352 desktop has been changed. Generally this should be FALSE. */
353 void client_set_desktop(ObClient
*self
, guint target
, gboolean donthide
);
355 /*! Validate client, by making sure no Destroy or Unmap events exist in
356 the event queue for the window.
357 @return true if the client is valid; false if the client has already
358 been unmapped/destroyed, and so is invalid.
360 gboolean
client_validate(ObClient
*self
);
362 /*! Sets the wm_state to the specified value */
363 void client_set_wm_state(ObClient
*self
, long state
);
365 /*! Adjusts the window's net_state
366 This should not be called as part of the window mapping process! It is for
367 use when updating the state post-mapping.<br>
368 client_apply_startup_state is used to do the same things during the mapping
371 void client_set_state(ObClient
*self
, Atom action
, long data1
, long data2
);
373 /* Given a ObClient, find the client that focus would actually be sent to if
374 you wanted to give focus to the specified ObClient. Will return the same
375 ObClient passed to it or another ObClient if appropriate. */
376 ObClient
*client_focus_target(ObClient
*self
);
378 /*! Returns what client_focus would return if passed the same client, but
379 without focusing it or modifying the focus order lists. */
380 gboolean
client_can_focus(ObClient
*self
);
382 /*! Attempt to focus the client window */
383 gboolean
client_focus(ObClient
*self
);
385 /*! Remove focus from the client window */
386 void client_unfocus(ObClient
*self
);
388 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
389 when the user deliberately selects a window for use. */
390 void client_activate(ObClient
*self
);
392 /*! Calculates the stacking layer for the client window */
393 void client_calc_layer(ObClient
*self
);
395 /*! Updates the window's transient status, and any parents of it */
396 void client_update_transient_for(ObClient
*self
);
397 /*! Update the protocols that the window supports and adjusts things if they
399 void client_update_protocols(ObClient
*self
);
400 /*! Updates the WMNormalHints and adjusts things if they change */
401 void client_update_normal_hints(ObClient
*self
);
403 /*! Updates the WMHints and adjusts things if they change
404 @param initstate Whether to read the initial_state property from the
405 WMHints. This should only be used during the mapping
408 void client_update_wmhints(ObClient
*self
);
409 /*! Updates the window's title and icon title */
410 void client_update_title(ObClient
*self
);
411 /*! Updates the window's application name and class */
412 void client_update_class(ObClient
*self
);
413 /*! Updates the strut for the client */
414 void client_update_strut(ObClient
*self
);
415 /*! Updates the window's icons */
416 void client_update_icons(ObClient
*self
);
418 /*! Set up what decor should be shown on the window and what functions should
419 be allowed (ObClient::decorations and ObClient::functions).
420 This also updates the NET_WM_ALLOWED_ACTIONS hint.
422 void client_setup_decor_and_functions(ObClient
*self
);
424 /*! Retrieves the window's type and sets ObClient->type */
425 void client_get_type(ObClient
*self
);
427 ObClientIcon
*client_icon(ObClient
*self
, int w
, int h
);
429 /*! Searches a client's transients for a focused window. The function does not
430 check for the passed client, only for its transients.
431 If no focused transient is found, NULL is returned.
433 ObClient
*client_search_focus_tree(ObClient
*self
);
435 /*! Searches a client's transient tree for a focused window. The function
436 searches up the tree and down other branches as well as the passed client's.
437 If no focused client is found, NULL is returned.
439 ObClient
*client_search_focus_tree_full(ObClient
*self
);
441 /*! Return a modal child of the client window that can be focused.
442 @return A modal child of the client window that can be focused, or 0 if
445 ObClient
*client_search_modal_child(ObClient
*self
);
447 ObClient
*client_search_top_transient(ObClient
*self
);
449 /*! Return the "closest" client in the given direction */
450 ObClient
*client_find_directional(ObClient
*c
, ObDirection dir
);
452 /*! Set a client window to be above/below other clients.
453 @layer < 0 indicates the client should be placed below other clients.<br>
454 = 0 indicates the client should be placed with other clients.<br>
455 > 0 indicates the client should be placed above other clients.
457 void client_set_layer(ObClient
*self
, int layer
);
459 guint
client_monitor(ObClient
*self
);