8 #include "render/color.h"
15 struct _ObSessionState
;
17 typedef struct _ObClient ObClient
;
18 typedef struct _ObClientIcon ObClientIcon
;
20 /* The value in client.transient_for indicating it is a transient for its
21 group instead of for a single window */
22 #define OB_TRAN_GROUP ((void*)~0l)
24 /*! Holds an icon in ARGB format */
32 /*! Possible window types */
35 OB_CLIENT_TYPE_DESKTOP
, /*!< A desktop (bottom-most window) */
36 OB_CLIENT_TYPE_DOCK
, /*!< A dock bar/panel window */
37 OB_CLIENT_TYPE_TOOLBAR
, /*!< A toolbar window, pulled off an app */
38 OB_CLIENT_TYPE_MENU
, /*!< An unpinned menu from an app */
39 OB_CLIENT_TYPE_UTILITY
, /*!< A small utility window such as a palette */
40 OB_CLIENT_TYPE_SPLASH
, /*!< A splash screen window */
41 OB_CLIENT_TYPE_DIALOG
, /*!< A dialog window */
42 OB_CLIENT_TYPE_NORMAL
/*!< A normal application window */
45 /*! The things the user can do to the client window */
48 OB_CLIENT_FUNC_RESIZE
= 1 << 0, /*!< Allow user resizing */
49 OB_CLIENT_FUNC_MOVE
= 1 << 1, /*!< Allow user moving */
50 OB_CLIENT_FUNC_ICONIFY
= 1 << 2, /*!< Allow to be iconified */
51 OB_CLIENT_FUNC_MAXIMIZE
= 1 << 3, /*!< Allow to be maximized */
52 OB_CLIENT_FUNC_SHADE
= 1 << 4, /*!< Allow to be shaded */
53 OB_CLIENT_FUNC_FULLSCREEN
= 1 << 5, /*!< Allow to be made fullscreen */
54 OB_CLIENT_FUNC_CLOSE
= 1 << 6 /*!< Allow to be closed */
63 /*! The window's decorations. NULL while the window is being managed! */
64 struct _ObFrame
*frame
;
66 /*! The number of unmap events to ignore on the window */
69 /*! The id of the group the window belongs to */
70 struct _ObGroup
*group
;
72 /*! Saved session data to apply to this client */
73 struct _ObSessionState
*session
;
75 /*! Whether or not the client is a transient window. This is guaranteed to
76 be TRUE if transient_for != NULL, but not guaranteed to be FALSE if
77 transient_for == NULL. */
79 /*! The client which this client is a transient (child) for.
80 A value of TRAN_GROUP signifies that the window is a transient for all
81 members of its ObGroup, and is not a valid pointer to be followed in this
84 ObClient
*transient_for
;
85 /*! The clients which are transients (children) of this client */
87 /*! The desktop on which the window resides (0xffffffff for all
91 /*! The startup id for the startup-notification protocol. This will be
92 NULL if a startup id is not set. */
95 /*! Normal window title */
97 /*! The count for the title. When another window with the same title
98 exists, a count will be appended to it. */
100 /*! Window title when iconified */
103 /*! The application that created the window */
105 /*! The class of the window, can used for grouping */
107 /*! The specified role of the window, used for identification */
109 /*! The session client id for the window. *This can be NULL!* */
112 /*! The type of window (what its function is) */
115 /*! Position and size of the window
116 This will not always be the actual position of the window on screen, it
117 is, rather, the position requested by the client, to which the window's
122 /*! The window's strut
123 The strut defines areas of the screen that are marked off-bounds for
124 window placement. In theory, where this window exists.
128 /*! The logical size of the window
129 The "logical" size of the window is refers to the user's perception of
130 the size of the window, and is the value that should be displayed to the
131 user. For example, with xterms, this value it the number of characters
132 being displayed in the terminal, instead of the number of pixels.
136 /*! Width of the border on the window.
137 The window manager will set this to 0 while the window is being managed,
138 but needs to restore it afterwards, so it is saved here.
142 /*! The minimum aspect ratio the client window can be sized to.
143 A value of 0 means this is ignored.
146 /*! The maximum aspect ratio the client window can be sized to.
147 A value of 0 means this is ignored.
151 /*! The minimum size of the client window
152 If the min is > the max, then the window is not resizable
155 /*! The maximum size of the client window
156 If the min is > the max, then the window is not resizable
159 /*! The size of increments to resize the client window by */
161 /*! The base size of the client window
162 This value should be subtracted from the window's actual size when
163 displaying its size to the user, or working with its min/max size
167 /*! Window decoration and functionality hints */
170 /*! Where to place the decorated window in relation to the undecorated
174 /*! The state of the window, one of WithdrawnState, IconicState, or
178 /*! True if the client supports the delete_window protocol */
179 gboolean delete_window
;
181 /*! Was the window's position requested by the application? if not, we
182 should place the window ourselves when it first appears */
185 /*! Can the window receive input focus? */
189 /*! Notify the window when it receives focus? */
190 gboolean focus_notify
;
192 /*! The window uses shape extension to be non-rectangular? */
195 /*! The window is modal, so it must be processed before any windows it is
196 related to can be focused */
198 /*! Only the window's titlebar is displayed */
200 /*! The window is iconified */
202 /*! The window is maximized to fill the screen vertically */
204 /*! The window is maximized to fill the screen horizontally */
206 /*! The window should not be displayed by pagers */
208 /*! The window should not be displayed by taskbars */
209 gboolean skip_taskbar
;
210 /*! The window is a 'fullscreen' window, and should be on top of all
213 /*! The window should be on top of other windows of the same type.
214 above takes priority over below. */
216 /*! The window should be underneath other windows of the same type.
217 above takes priority over below. */
220 /*! The layer in which the window will be stacked, windows in lower layers
221 are always below windows in higher layers. */
222 ObStackingLayer layer
;
224 /*! A bitmask of values in the ObFrameDecorations enum
225 The values in the variable are the decorations that the client wants to
226 be displayed around it.
230 /*! A user option. When this is set to FALSE the client will not ever
235 /*! A bitmask of values in the ObFunctions enum
236 The values in the variable specify the ways in which the user is allowed
237 to modify this window.
241 /*! Icons for the client as specified on the client window */
243 /*! The number of icons in icons */
247 extern GList
*client_list
;
249 void client_startup(gboolean reconfig
);
250 void client_shutdown(gboolean reconfig
);
252 void client_add_destructor(GDestroyNotify func
);
253 void client_remove_destructor(GDestroyNotify func
);
255 /*! Manages all existing windows */
256 void client_manage_all();
257 /*! Manages a given window */
258 void client_manage(Window win
);
259 /*! Unmanages all managed windows */
260 void client_unmanage_all();
261 /*! Unmanages a given client */
262 void client_unmanage(ObClient
*client
);
264 /*! Sets the client list on the root window from the client_list */
265 void client_set_list();
267 /*! Determines if the client should be shown or hidden currently.
268 @return TRUE if it should be visible; otherwise, FALSE.
270 gboolean
client_should_show(ObClient
*self
);
272 /*! Returns if the window should be treated as a normal window.
273 Some windows (desktops, docks, splash screens) have special rules applied
274 to them in a number of places regarding focus or user interaction. */
275 gboolean
client_normal(ObClient
*self
);
277 /* Returns if the window is focused */
278 gboolean
client_focused(ObClient
*self
);
280 #define client_move(self, x, y) \
281 client_configure(self, OB_CORNER_TOPLEFT, x, y, \
282 self->area.width, self->area.height, \
284 #define client_resize(self, w, h) \
285 client_configure(self, OB_CORNER_TOPLEFT, self->area.x, self->area.y, \
287 #define client_move_resize(self, x, y, w, h) \
288 client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE)
290 #define client_configure(self, anchor, x, y, w, h, user, final) \
291 client_configure_full(self, anchor, x, y, w, h, user, final, FALSE)
293 /*! Move and/or resize the window.
294 This also maintains things like the client's minsize, and size increments.
295 @param anchor The corner to keep in the same position when resizing.
296 @param x The x coordiante of the new position for the client.
297 @param y The y coordiante of the new position for the client.
298 @param w The width component of the new size for the client.
299 @param h The height component of the new size for the client.
300 @param user Specifies whether this is a user-requested change or a
301 program requested change. For program requested changes, the
302 constraints are not checked.
303 @param final If user is true, then this should specify if this is a final
304 configuration. e.g. Final should be FALSE if doing an
305 interactive move/resize, and then be TRUE for the last call
307 @param force_reply Send a ConfigureNotify to the client regardless of if
308 the position changed.
310 void client_configure_full(ObClient
*self
, ObCorner anchor
,
311 int x
, int y
, int w
, int h
,
312 gboolean user
, gboolean final
,
313 gboolean force_reply
);
315 void client_reconfigure(ObClient
*self
);
317 /*! Finds coordinates to keep a client on the screen.
318 @param self The client
319 @param x The x coord of the client, may be changed.
320 @param y The y coord of the client, may be changed.
321 @param w The width of the client.
322 @param w The height of the client.
323 @param rude Be rude about it. If false, it is only moved if it is entirely
324 not visible. If true, then make sure the window is inside the
326 @return true if the client was moved to be on-screen; false if not.
328 gboolean
client_find_onscreen(ObClient
*self
, int *x
, int *y
, int w
, int h
,
331 /*! Moves a client so that it is on screen if it is entirely out of the
333 @param self The client to move
334 @param rude Be rude about it. If false, it is only moved if it is entirely
335 not visible. If true, then make sure the window is inside the
338 void client_move_onscreen(ObClient
*self
, gboolean rude
);
340 /*! Fullscreen's or unfullscreen's the client window
341 @param fs true if the window should be made fullscreen; false if it should
342 be returned to normal state.
343 @param savearea true to have the client's current size and position saved;
344 otherwise, they are not. You should not save when mapping a
345 new window that is set to fullscreen. This has no effect
346 when restoring a window from fullscreen.
348 void client_fullscreen(ObClient
*self
, gboolean fs
, gboolean savearea
);
350 /*! Iconifies or uniconifies the client window
351 @param iconic true if the window should be iconified; false if it should be
353 @param curdesk If iconic is FALSE, then this determines if the window will
354 be uniconified to the current viewable desktop (true) or to
355 its previous desktop (false)
357 void client_iconify(ObClient
*self
, gboolean iconic
, gboolean curdesk
);
359 /*! Maximize or unmaximize the client window
360 @param max true if the window should be maximized; false if it should be
361 returned to normal size.
362 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
363 @param savearea true to have the client's current size and position saved;
364 otherwise, they are not. You should not save when mapping a
365 new window that is set to fullscreen. This has no effect
366 when unmaximizing a window.
368 void client_maximize(ObClient
*self
, gboolean max
, int dir
,
371 /*! Shades or unshades the client window
372 @param shade true if the window should be shaded; false if it should be
375 void client_shade(ObClient
*self
, gboolean shade
);
377 /*! Request the client to close its window */
378 void client_close(ObClient
*self
);
380 /*! Kill the client off violently */
381 void client_kill(ObClient
*self
);
383 /*! Sends the window to the specified desktop
384 @param donthide If TRUE, the window will not be shown/hidden after its
385 desktop has been changed. Generally this should be FALSE. */
386 void client_set_desktop(ObClient
*self
, guint target
, gboolean donthide
);
388 /*! Validate client, by making sure no Destroy or Unmap events exist in
389 the event queue for the window.
390 @return true if the client is valid; false if the client has already
391 been unmapped/destroyed, and so is invalid.
393 gboolean
client_validate(ObClient
*self
);
395 /*! Sets the wm_state to the specified value */
396 void client_set_wm_state(ObClient
*self
, long state
);
398 /*! Adjusts the window's net_state
399 This should not be called as part of the window mapping process! It is for
400 use when updating the state post-mapping.<br>
401 client_apply_startup_state is used to do the same things during the mapping
404 void client_set_state(ObClient
*self
, Atom action
, long data1
, long data2
);
406 /* Given a ObClient, find the client that focus would actually be sent to if
407 you wanted to give focus to the specified ObClient. Will return the same
408 ObClient passed to it or another ObClient if appropriate. */
409 ObClient
*client_focus_target(ObClient
*self
);
411 /*! Returns what client_focus would return if passed the same client, but
412 without focusing it or modifying the focus order lists. */
413 gboolean
client_can_focus(ObClient
*self
);
415 /*! Attempt to focus the client window */
416 gboolean
client_focus(ObClient
*self
);
418 /*! Remove focus from the client window */
419 void client_unfocus(ObClient
*self
);
421 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
422 when the user deliberately selects a window for use.
423 @param here If true, then the client is brought to the current desktop;
424 otherwise, the desktop is changed to where the client lives.
426 void client_activate(ObClient
*self
, gboolean here
);
428 /*! Calculates the stacking layer for the client window */
429 void client_calc_layer(ObClient
*self
);
431 /*! Updates the window's transient status, and any parents of it */
432 void client_update_transient_for(ObClient
*self
);
433 /*! Update the protocols that the window supports and adjusts things if they
435 void client_update_protocols(ObClient
*self
);
436 /*! Updates the WMNormalHints and adjusts things if they change */
437 void client_update_normal_hints(ObClient
*self
);
439 /*! Updates the WMHints and adjusts things if they change
440 @param initstate Whether to read the initial_state property from the
441 WMHints. This should only be used during the mapping
444 void client_update_wmhints(ObClient
*self
);
445 /*! Updates the window's title and icon title */
446 void client_update_title(ObClient
*self
);
447 /*! Updates the window's application name and class */
448 void client_update_class(ObClient
*self
);
449 /*! Updates the strut for the client */
450 void client_update_strut(ObClient
*self
);
451 /*! Updates the window's icons */
452 void client_update_icons(ObClient
*self
);
454 /*! Set up what decor should be shown on the window and what functions should
455 be allowed (ObClient::decorations and ObClient::functions).
456 This also updates the NET_WM_ALLOWED_ACTIONS hint.
458 void client_setup_decor_and_functions(ObClient
*self
);
460 /*! Retrieves the window's type and sets ObClient->type */
461 void client_get_type(ObClient
*self
);
463 ObClientIcon
*client_icon(ObClient
*self
, int w
, int h
);
465 /*! Searches a client's transients for a focused window. The function does not
466 check for the passed client, only for its transients.
467 If no focused transient is found, NULL is returned.
469 ObClient
*client_search_focus_tree(ObClient
*self
);
471 /*! Searches a client's transient tree for a focused window. The function
472 searches up the tree and down other branches as well as the passed client's.
473 If no focused client is found, NULL is returned.
475 ObClient
*client_search_focus_tree_full(ObClient
*self
);
477 /*! Return a modal child of the client window that can be focused.
478 @return A modal child of the client window that can be focused, or 0 if
481 ObClient
*client_search_modal_child(ObClient
*self
);
483 ObClient
*client_search_top_transient(ObClient
*self
);
485 ObClient
*client_search_transient(ObClient
*self
, ObClient
*search
);
487 /*! Return the "closest" client in the given direction */
488 ObClient
*client_find_directional(ObClient
*c
, ObDirection dir
);
490 /*! Return the closest edge in the given direction */
491 int client_directional_edge_search(ObClient
*c
, ObDirection dir
);
493 /*! Set a client window to be above/below other clients.
494 @layer < 0 indicates the client should be placed below other clients.<br>
495 = 0 indicates the client should be placed with other clients.<br>
496 > 0 indicates the client should be placed above other clients.
498 void client_set_layer(ObClient
*self
, int layer
);
500 guint
client_monitor(ObClient
*self
);
502 void client_update_sm_client_id(ObClient
*self
);