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 */
62 /*! The window's decorations. NULL while the window is being managed! */
63 struct _ObFrame
*frame
;
65 /*! The number of unmap events to ignore on the window */
68 /*! The id of the group the window belongs to */
69 struct _ObGroup
*group
;
70 /*! Whether or not the client is a transient window. This is guaranteed to
71 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
72 transient_for == NULL. */
74 /*! The client which this client is a transient (child) for.
75 A value of TRAN_GROUP signifies that the window is a transient for all
76 members of its ObGroup, and is not a valid pointer to be followed in this
79 ObClient
*transient_for
;
80 /*! The clients which are transients (children) of this client */
82 /*! The desktop on which the window resides (0xffffffff for all
86 /*! Normal window title */
88 /*! The count for the title. When another window with the same title
89 exists, a count will be appended to it. */
91 /*! Window title when iconified */
94 /*! The application that created the window */
96 /*! The class of the window, can used for grouping */
98 /*! The specified role of the window, used for identification */
101 /*! The type of window (what its function is) */
104 /*! Position and size of the window
105 This will not always be the actual position of the window on screen, it
106 is, rather, the position requested by the client, to which the window's
111 /*! The window's strut
112 The strut defines areas of the screen that are marked off-bounds for
113 window placement. In theory, where this window exists.
117 /*! The logical size of the window
118 The "logical" size of the window is refers to the user's perception of
119 the size of the window, and is the value that should be displayed to the
120 user. For example, with xterms, this value it the number of characters
121 being displayed in the terminal, instead of the number of pixels.
125 /*! Width of the border on the window.
126 The window manager will set this to 0 while the window is being managed,
127 but needs to restore it afterwards, so it is saved here.
131 /*! The minimum aspect ratio the client window can be sized to.
132 A value of 0 means this is ignored.
135 /*! The maximum aspect ratio the client window can be sized to.
136 A value of 0 means this is ignored.
140 /*! The minimum size of the client window
141 If the min is > the max, then the window is not resizable
144 /*! The maximum size of the client window
145 If the min is > the max, then the window is not resizable
148 /*! The size of increments to resize the client window by */
150 /*! The base size of the client window
151 This value should be subtracted from the window's actual size when
152 displaying its size to the user, or working with its min/max size
156 /*! Window decoration and functionality hints */
159 /*! Where to place the decorated window in relation to the undecorated
163 /*! The state of the window, one of WithdrawnState, IconicState, or
167 /*! True if the client supports the delete_window protocol */
168 gboolean delete_window
;
170 /*! Was the window's position requested by the application? if not, we
171 should place the window ourselves when it first appears */
174 /*! Can the window receive input focus? */
178 /*! Notify the window when it receives focus? */
179 gboolean focus_notify
;
181 /*! The window uses shape extension to be non-rectangular? */
184 /*! The window is modal, so it must be processed before any windows it is
185 related to can be focused */
187 /*! Only the window's titlebar is displayed */
189 /*! The window is iconified */
191 /*! The window is maximized to fill the screen vertically */
193 /*! The window is maximized to fill the screen horizontally */
195 /*! The window should not be displayed by pagers */
197 /*! The window should not be displayed by taskbars */
198 gboolean skip_taskbar
;
199 /*! The window is a 'fullscreen' window, and should be on top of all
202 /*! The window should be on top of other windows of the same type.
203 above takes priority over below. */
205 /*! The window should be underneath other windows of the same type.
206 above takes priority over below. */
209 /*! The layer in which the window will be stacked, windows in lower layers
210 are always below windows in higher layers. */
211 ObStackingLayer layer
;
213 /*! A bitmask of values in the ObFrameDecorations enum
214 The values in the variable are the decorations that the client wants to
215 be displayed around it.
219 /*! A user option. When this is set to FALSE the client will not ever
224 /*! A bitmask of values in the ObFunctions enum
225 The values in the variable specify the ways in which the user is allowed
226 to modify this window.
230 /*! Icons for the client as specified on the client window */
232 /*! The number of icons in icons */
236 extern GList
*client_list
;
238 void client_startup();
239 void client_shutdown();
241 /*! Manages all existing windows */
242 void client_manage_all();
243 /*! Manages a given window */
244 void client_manage(Window win
);
245 /*! Unmanages all managed windows */
246 void client_unmanage_all();
247 /*! Unmanages a given client */
248 void client_unmanage(ObClient
*client
);
250 /*! Sets the client list on the root window from the client_list */
251 void client_set_list();
253 /*! Determines if the client should be shown or hidden currently.
254 @return TRUE if it should be visible; otherwise, FALSE.
256 gboolean
client_should_show(ObClient
*self
);
258 /*! Returns if the window should be treated as a normal window.
259 Some windows (desktops, docks, splash screens) have special rules applied
260 to them in a number of places regarding focus or user interaction. */
261 gboolean
client_normal(ObClient
*self
);
263 /* Returns if the window is focused */
264 gboolean
client_focused(ObClient
*self
);
266 /*! Move and/or resize the window.
267 This also maintains things like the client's minsize, and size increments.
268 @param anchor The corner to keep in the same position when resizing.
269 @param x The x coordiante of the new position for the client.
270 @param y The y coordiante of the new position for the client.
271 @param w The width component of the new size for the client.
272 @param h The height component of the new size for the client.
273 @param user Specifies whether this is a user-requested change or a
274 program requested change. For program requested changes, the
275 constraints are not checked.
276 @param final If user is true, then this should specify if this is a final
277 configuration. e.g. Final should be FALSE if doing an
278 interactive move/resize, and then be TRUE for the last call
281 void client_configure(ObClient
*self
, ObCorner anchor
,
282 int x
, int y
, int w
, int h
,
283 gboolean user
, gboolean final
);
285 void client_reconfigure(ObClient
*self
);
287 /*! Finds coordinates to keep a client on the screen.
288 @param self The client
289 @param x The x coord of the client, may be changed.
290 @param y The y coord of the client, may be changed.
291 @param w The width of the client.
292 @param w The height of the client.
293 @param rude Be rude about it. If false, it is only moved if it is entirely
294 not visible. If true, then make sure the window is inside the
296 @return true if the client was moved to be on-screen; false if not.
298 gboolean
client_find_onscreen(ObClient
*self
, int *x
, int *y
, int w
, int h
,
301 /*! Moves a client so that it is on screen if it is entirely out of the
303 @param self The client to move
304 @param rude Be rude about it. If false, it is only moved if it is entirely
305 not visible. If true, then make sure the window is inside the
308 void client_move_onscreen(ObClient
*self
, gboolean rude
);
310 /*! Fullscreen's or unfullscreen's the client window
311 @param fs true if the window should be made fullscreen; false if it should
312 be returned to normal state.
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 restoring a window from fullscreen.
318 void client_fullscreen(ObClient
*self
, gboolean fs
, gboolean savearea
);
320 /*! Iconifies or uniconifies the client window
321 @param iconic true if the window should be iconified; false if it should be
323 @param curdesk If iconic is FALSE, then this determines if the window will
324 be uniconified to the current viewable desktop (true) or to
325 its previous desktop (false)
327 void client_iconify(ObClient
*self
, gboolean iconic
, gboolean curdesk
);
329 /*! Maximize or unmaximize the client window
330 @param max true if the window should be maximized; false if it should be
331 returned to normal size.
332 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
333 @param savearea true to have the client's current size and position saved;
334 otherwise, they are not. You should not save when mapping a
335 new window that is set to fullscreen. This has no effect
336 when unmaximizing a window.
338 void client_maximize(ObClient
*self
, gboolean max
, int dir
,
341 /*! Shades or unshades the client window
342 @param shade true if the window should be shaded; false if it should be
345 void client_shade(ObClient
*self
, gboolean shade
);
347 /*! Request the client to close its window */
348 void client_close(ObClient
*self
);
350 /*! Kill the client off violently */
351 void client_kill(ObClient
*self
);
353 /*! Sends the window to the specified desktop
354 @param donthide If TRUE, the window will not be shown/hidden after its
355 desktop has been changed. Generally this should be FALSE. */
356 void client_set_desktop(ObClient
*self
, guint target
, gboolean donthide
);
358 /*! Validate client, by making sure no Destroy or Unmap events exist in
359 the event queue for the window.
360 @return true if the client is valid; false if the client has already
361 been unmapped/destroyed, and so is invalid.
363 gboolean
client_validate(ObClient
*self
);
365 /*! Sets the wm_state to the specified value */
366 void client_set_wm_state(ObClient
*self
, long state
);
368 /*! Adjusts the window's net_state
369 This should not be called as part of the window mapping process! It is for
370 use when updating the state post-mapping.<br>
371 client_apply_startup_state is used to do the same things during the mapping
374 void client_set_state(ObClient
*self
, Atom action
, long data1
, long data2
);
376 /* Given a ObClient, find the client that focus would actually be sent to if
377 you wanted to give focus to the specified ObClient. Will return the same
378 ObClient passed to it or another ObClient if appropriate. */
379 ObClient
*client_focus_target(ObClient
*self
);
381 /*! Returns what client_focus would return if passed the same client, but
382 without focusing it or modifying the focus order lists. */
383 gboolean
client_can_focus(ObClient
*self
);
385 /*! Attempt to focus the client window */
386 gboolean
client_focus(ObClient
*self
);
388 /*! Remove focus from the client window */
389 void client_unfocus(ObClient
*self
);
391 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
392 when the user deliberately selects a window for use. */
393 void client_activate(ObClient
*self
);
395 /*! Calculates the stacking layer for the client window */
396 void client_calc_layer(ObClient
*self
);
398 /*! Updates the window's transient status, and any parents of it */
399 void client_update_transient_for(ObClient
*self
);
400 /*! Update the protocols that the window supports and adjusts things if they
402 void client_update_protocols(ObClient
*self
);
403 /*! Updates the WMNormalHints and adjusts things if they change */
404 void client_update_normal_hints(ObClient
*self
);
406 /*! Updates the WMHints and adjusts things if they change
407 @param initstate Whether to read the initial_state property from the
408 WMHints. This should only be used during the mapping
411 void client_update_wmhints(ObClient
*self
);
412 /*! Updates the window's title and icon title */
413 void client_update_title(ObClient
*self
);
414 /*! Updates the window's application name and class */
415 void client_update_class(ObClient
*self
);
416 /*! Updates the strut for the client */
417 void client_update_strut(ObClient
*self
);
418 /*! Updates the window's icons */
419 void client_update_icons(ObClient
*self
);
421 /*! Set up what decor should be shown on the window and what functions should
422 be allowed (ObClient::decorations and ObClient::functions).
423 This also updates the NET_WM_ALLOWED_ACTIONS hint.
425 void client_setup_decor_and_functions(ObClient
*self
);
427 /*! Retrieves the window's type and sets ObClient->type */
428 void client_get_type(ObClient
*self
);
430 ObClientIcon
*client_icon(ObClient
*self
, int w
, int h
);
432 /*! Searches a client's transients for a focused window. The function does not
433 check for the passed client, only for its transients.
434 If no focused transient is found, NULL is returned.
436 ObClient
*client_search_focus_tree(ObClient
*self
);
438 /*! Searches a client's transient tree for a focused window. The function
439 searches up the tree and down other branches as well as the passed client's.
440 If no focused client is found, NULL is returned.
442 ObClient
*client_search_focus_tree_full(ObClient
*self
);
444 /*! Return a modal child of the client window that can be focused.
445 @return A modal child of the client window that can be focused, or 0 if
448 ObClient
*client_search_modal_child(ObClient
*self
);
450 ObClient
*client_search_top_transient(ObClient
*self
);
452 ObClient
*client_search_transient(ObClient
*self
, ObClient
*search
);
454 /*! Return the "closest" client in the given direction */
455 ObClient
*client_find_directional(ObClient
*c
, ObDirection dir
);
457 /*! Set a client window to be above/below other clients.
458 @layer < 0 indicates the client should be placed below other clients.<br>
459 = 0 indicates the client should be placed with other clients.<br>
460 > 0 indicates the client should be placed above other clients.
462 void client_set_layer(ObClient
*self
, int layer
);
464 guint
client_monitor(ObClient
*self
);