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 */
110 /*! The type of window (what its function is) */
113 /*! Position and size of the window
114 This will not always be the actual position of the window on screen, it
115 is, rather, the position requested by the client, to which the window's
120 /*! The window's strut
121 The strut defines areas of the screen that are marked off-bounds for
122 window placement. In theory, where this window exists.
126 /*! The logical size of the window
127 The "logical" size of the window is refers to the user's perception of
128 the size of the window, and is the value that should be displayed to the
129 user. For example, with xterms, this value it the number of characters
130 being displayed in the terminal, instead of the number of pixels.
134 /*! Width of the border on the window.
135 The window manager will set this to 0 while the window is being managed,
136 but needs to restore it afterwards, so it is saved here.
140 /*! The minimum aspect ratio the client window can be sized to.
141 A value of 0 means this is ignored.
144 /*! The maximum aspect ratio the client window can be sized to.
145 A value of 0 means this is ignored.
149 /*! The minimum size of the client window
150 If the min is > the max, then the window is not resizable
153 /*! The maximum size of the client window
154 If the min is > the max, then the window is not resizable
157 /*! The size of increments to resize the client window by */
159 /*! The base size of the client window
160 This value should be subtracted from the window's actual size when
161 displaying its size to the user, or working with its min/max size
165 /*! Window decoration and functionality hints */
168 /*! Where to place the decorated window in relation to the undecorated
172 /*! The state of the window, one of WithdrawnState, IconicState, or
176 /*! True if the client supports the delete_window protocol */
177 gboolean delete_window
;
179 /*! Was the window's position requested by the application? if not, we
180 should place the window ourselves when it first appears */
183 /*! Can the window receive input focus? */
187 /*! Notify the window when it receives focus? */
188 gboolean focus_notify
;
190 /*! The window uses shape extension to be non-rectangular? */
193 /*! The window is modal, so it must be processed before any windows it is
194 related to can be focused */
196 /*! Only the window's titlebar is displayed */
198 /*! The window is iconified */
200 /*! The window is maximized to fill the screen vertically */
202 /*! The window is maximized to fill the screen horizontally */
204 /*! The window should not be displayed by pagers */
206 /*! The window should not be displayed by taskbars */
207 gboolean skip_taskbar
;
208 /*! The window is a 'fullscreen' window, and should be on top of all
211 /*! The window should be on top of other windows of the same type.
212 above takes priority over below. */
214 /*! The window should be underneath other windows of the same type.
215 above takes priority over below. */
218 /*! The layer in which the window will be stacked, windows in lower layers
219 are always below windows in higher layers. */
220 ObStackingLayer layer
;
222 /*! A bitmask of values in the ObFrameDecorations enum
223 The values in the variable are the decorations that the client wants to
224 be displayed around it.
228 /*! A user option. When this is set to FALSE the client will not ever
233 /*! A bitmask of values in the ObFunctions enum
234 The values in the variable specify the ways in which the user is allowed
235 to modify this window.
239 /*! Icons for the client as specified on the client window */
241 /*! The number of icons in icons */
245 extern GList
*client_list
;
247 void client_startup(gboolean reconfig
);
248 void client_shutdown(gboolean reconfig
);
250 void client_add_destructor(GDestroyNotify func
);
251 void client_remove_destructor(GDestroyNotify func
);
253 /*! Manages all existing windows */
254 void client_manage_all();
255 /*! Manages a given window */
256 void client_manage(Window win
);
257 /*! Unmanages all managed windows */
258 void client_unmanage_all();
259 /*! Unmanages a given client */
260 void client_unmanage(ObClient
*client
);
262 /*! Sets the client list on the root window from the client_list */
263 void client_set_list();
265 /*! Determines if the client should be shown or hidden currently.
266 @return TRUE if it should be visible; otherwise, FALSE.
268 gboolean
client_should_show(ObClient
*self
);
270 /*! Returns if the window should be treated as a normal window.
271 Some windows (desktops, docks, splash screens) have special rules applied
272 to them in a number of places regarding focus or user interaction. */
273 gboolean
client_normal(ObClient
*self
);
275 /* Returns if the window is focused */
276 gboolean
client_focused(ObClient
*self
);
278 #define client_move(self, x, y) \
279 client_configure(self, OB_CORNER_TOPLEFT, x, y, \
280 self->area.width, self->area.height, \
282 #define client_resize(self, w, h) \
283 client_configure(self, OB_CORNER_TOPLEFT, self->area.x, self->area.y, \
285 #define client_move_resize(self, x, y, w, h) \
286 client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE)
288 #define client_configure(self, anchor, x, y, w, h, user, final) \
289 client_configure_full(self, anchor, x, y, w, h, user, final, FALSE)
291 /*! Move and/or resize the window.
292 This also maintains things like the client's minsize, and size increments.
293 @param anchor The corner to keep in the same position when resizing.
294 @param x The x coordiante of the new position for the client.
295 @param y The y coordiante of the new position for the client.
296 @param w The width component of the new size for the client.
297 @param h The height component of the new size for the client.
298 @param user Specifies whether this is a user-requested change or a
299 program requested change. For program requested changes, the
300 constraints are not checked.
301 @param final If user is true, then this should specify if this is a final
302 configuration. e.g. Final should be FALSE if doing an
303 interactive move/resize, and then be TRUE for the last call
305 @param force_reply Send a ConfigureNotify to the client regardless of if
306 the position changed.
308 void client_configure_full(ObClient
*self
, ObCorner anchor
,
309 int x
, int y
, int w
, int h
,
310 gboolean user
, gboolean final
,
311 gboolean force_reply
);
313 void client_reconfigure(ObClient
*self
);
315 /*! Finds coordinates to keep a client on the screen.
316 @param self The client
317 @param x The x coord of the client, may be changed.
318 @param y The y coord of the client, may be changed.
319 @param w The width of the client.
320 @param w The height of the client.
321 @param rude Be rude about it. If false, it is only moved if it is entirely
322 not visible. If true, then make sure the window is inside the
324 @return true if the client was moved to be on-screen; false if not.
326 gboolean
client_find_onscreen(ObClient
*self
, int *x
, int *y
, int w
, int h
,
329 /*! Moves a client so that it is on screen if it is entirely out of the
331 @param self The client to move
332 @param rude Be rude about it. If false, it is only moved if it is entirely
333 not visible. If true, then make sure the window is inside the
336 void client_move_onscreen(ObClient
*self
, gboolean rude
);
338 /*! Fullscreen's or unfullscreen's the client window
339 @param fs true if the window should be made fullscreen; false if it should
340 be returned to normal state.
341 @param savearea true to have the client's current size and position saved;
342 otherwise, they are not. You should not save when mapping a
343 new window that is set to fullscreen. This has no effect
344 when restoring a window from fullscreen.
346 void client_fullscreen(ObClient
*self
, gboolean fs
, gboolean savearea
);
348 /*! Iconifies or uniconifies the client window
349 @param iconic true if the window should be iconified; false if it should be
351 @param curdesk If iconic is FALSE, then this determines if the window will
352 be uniconified to the current viewable desktop (true) or to
353 its previous desktop (false)
355 void client_iconify(ObClient
*self
, gboolean iconic
, gboolean curdesk
);
357 /*! Maximize or unmaximize the client window
358 @param max true if the window should be maximized; false if it should be
359 returned to normal size.
360 @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
361 @param savearea true to have the client's current size and position saved;
362 otherwise, they are not. You should not save when mapping a
363 new window that is set to fullscreen. This has no effect
364 when unmaximizing a window.
366 void client_maximize(ObClient
*self
, gboolean max
, int dir
,
369 /*! Shades or unshades the client window
370 @param shade true if the window should be shaded; false if it should be
373 void client_shade(ObClient
*self
, gboolean shade
);
375 /*! Request the client to close its window */
376 void client_close(ObClient
*self
);
378 /*! Kill the client off violently */
379 void client_kill(ObClient
*self
);
381 /*! Sends the window to the specified desktop
382 @param donthide If TRUE, the window will not be shown/hidden after its
383 desktop has been changed. Generally this should be FALSE. */
384 void client_set_desktop(ObClient
*self
, guint target
, gboolean donthide
);
386 /*! Validate client, by making sure no Destroy or Unmap events exist in
387 the event queue for the window.
388 @return true if the client is valid; false if the client has already
389 been unmapped/destroyed, and so is invalid.
391 gboolean
client_validate(ObClient
*self
);
393 /*! Sets the wm_state to the specified value */
394 void client_set_wm_state(ObClient
*self
, long state
);
396 /*! Adjusts the window's net_state
397 This should not be called as part of the window mapping process! It is for
398 use when updating the state post-mapping.<br>
399 client_apply_startup_state is used to do the same things during the mapping
402 void client_set_state(ObClient
*self
, Atom action
, long data1
, long data2
);
404 /* Given a ObClient, find the client that focus would actually be sent to if
405 you wanted to give focus to the specified ObClient. Will return the same
406 ObClient passed to it or another ObClient if appropriate. */
407 ObClient
*client_focus_target(ObClient
*self
);
409 /*! Returns what client_focus would return if passed the same client, but
410 without focusing it or modifying the focus order lists. */
411 gboolean
client_can_focus(ObClient
*self
);
413 /*! Attempt to focus the client window */
414 gboolean
client_focus(ObClient
*self
);
416 /*! Remove focus from the client window */
417 void client_unfocus(ObClient
*self
);
419 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
420 when the user deliberately selects a window for use.
421 @param here If true, then the client is brought to the current desktop;
422 otherwise, the desktop is changed to where the client lives.
424 void client_activate(ObClient
*self
, gboolean here
);
426 /*! Calculates the stacking layer for the client window */
427 void client_calc_layer(ObClient
*self
);
429 /*! Updates the window's transient status, and any parents of it */
430 void client_update_transient_for(ObClient
*self
);
431 /*! Update the protocols that the window supports and adjusts things if they
433 void client_update_protocols(ObClient
*self
);
434 /*! Updates the WMNormalHints and adjusts things if they change */
435 void client_update_normal_hints(ObClient
*self
);
437 /*! Updates the WMHints and adjusts things if they change
438 @param initstate Whether to read the initial_state property from the
439 WMHints. This should only be used during the mapping
442 void client_update_wmhints(ObClient
*self
);
443 /*! Updates the window's title and icon title */
444 void client_update_title(ObClient
*self
);
445 /*! Updates the window's application name and class */
446 void client_update_class(ObClient
*self
);
447 /*! Updates the strut for the client */
448 void client_update_strut(ObClient
*self
);
449 /*! Updates the window's icons */
450 void client_update_icons(ObClient
*self
);
452 /*! Set up what decor should be shown on the window and what functions should
453 be allowed (ObClient::decorations and ObClient::functions).
454 This also updates the NET_WM_ALLOWED_ACTIONS hint.
456 void client_setup_decor_and_functions(ObClient
*self
);
458 /*! Retrieves the window's type and sets ObClient->type */
459 void client_get_type(ObClient
*self
);
461 ObClientIcon
*client_icon(ObClient
*self
, int w
, int h
);
463 /*! Searches a client's transients for a focused window. The function does not
464 check for the passed client, only for its transients.
465 If no focused transient is found, NULL is returned.
467 ObClient
*client_search_focus_tree(ObClient
*self
);
469 /*! Searches a client's transient tree for a focused window. The function
470 searches up the tree and down other branches as well as the passed client's.
471 If no focused client is found, NULL is returned.
473 ObClient
*client_search_focus_tree_full(ObClient
*self
);
475 /*! Return a modal child of the client window that can be focused.
476 @return A modal child of the client window that can be focused, or 0 if
479 ObClient
*client_search_modal_child(ObClient
*self
);
481 ObClient
*client_search_top_transient(ObClient
*self
);
483 ObClient
*client_search_transient(ObClient
*self
, ObClient
*search
);
485 /*! Return the "closest" client in the given direction */
486 ObClient
*client_find_directional(ObClient
*c
, ObDirection dir
);
488 /*! Return the closest edge in the given direction */
489 int client_directional_edge_search(ObClient
*c
, ObDirection dir
);
491 /*! Set a client window to be above/below other clients.
492 @layer < 0 indicates the client should be placed below other clients.<br>
493 = 0 indicates the client should be placed with other clients.<br>
494 > 0 indicates the client should be placed above other clients.
496 void client_set_layer(ObClient
*self
, int layer
);
498 guint
client_monitor(ObClient
*self
);
500 gchar
* client_get_sm_client_id(ObClient
*self
);