master
ブランチ master
ShaderPlayground / deps / xlibre / include / xcb / xcb_ewmh.h
99.8 KB、2456行 生 Blame 履歴
1#ifndef __XCB_EWMH_H__
2#define __XCB_EWMH_H__
3
4/*
5 * Copyright (C) 2009-2011 Arnaud Fontaine <arnau@debian.org>
6 *
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy,
11 * modify, merge, publish, distribute, sublicense, and/or sell copies
12 * of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 * Except as contained in this notice, the names of the authors or
27 * their institutions shall not be used in advertising or otherwise to
28 * promote the sale, use or other dealings in this Software without
29 * prior written authorization from the authors.
30 */
31
32/**
33 * @defgroup xcb__ewmh_t XCB EWMH Functions
34 *
35 * These functions allow easy handling of the protocol described in
36 * the Extended Window Manager Hints specification. The list of Atoms
37 * is stored as an M4 file (atomlist.m4) where each Atom is stored as
38 * a variable defined in the header.
39 *
40 * Replies of requests generating a list of pointers (such as list of
41 * windows, atoms and UTF-8 strings) are simply stored as a structure
42 * holding the XCB reply which should (usually) never be accessed
43 * directly and has to be wipe afterwards. This structure provides a
44 * convenient access to the list given in the reply itself.
45 *
46 * @{
47 */
48
49#include <xcb/xcb.h>
50#include <stdlib.h>
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56/**
57 * @brief Hold EWMH information specific to a screen
58 */
59typedef struct {
60 /** The X connection */
61 xcb_connection_t *connection;
62 /** The screens on this connection */
63 xcb_screen_t **screens;
64 int nb_screens;
65 /** _NET_WM_CM_Sn atoms depending on the number of screens */
66 xcb_atom_t *_NET_WM_CM_Sn;
67 /** The EWMH atoms of this connection */
68 xcb_atom_t _NET_SUPPORTED;
69 xcb_atom_t _NET_CLIENT_LIST;
70 xcb_atom_t _NET_CLIENT_LIST_STACKING;
71 xcb_atom_t _NET_NUMBER_OF_DESKTOPS;
72 xcb_atom_t _NET_DESKTOP_GEOMETRY;
73 xcb_atom_t _NET_DESKTOP_VIEWPORT;
74 xcb_atom_t _NET_CURRENT_DESKTOP;
75 xcb_atom_t _NET_DESKTOP_NAMES;
76 xcb_atom_t _NET_ACTIVE_WINDOW;
77 xcb_atom_t _NET_WORKAREA;
78 xcb_atom_t _NET_SUPPORTING_WM_CHECK;
79 xcb_atom_t _NET_VIRTUAL_ROOTS;
80 xcb_atom_t _NET_DESKTOP_LAYOUT;
81 xcb_atom_t _NET_SHOWING_DESKTOP;
82 xcb_atom_t _NET_CLOSE_WINDOW;
83 xcb_atom_t _NET_MOVERESIZE_WINDOW;
84 xcb_atom_t _NET_WM_MOVERESIZE;
85 xcb_atom_t _NET_RESTACK_WINDOW;
86 xcb_atom_t _NET_REQUEST_FRAME_EXTENTS;
87 xcb_atom_t _NET_WM_NAME;
88 xcb_atom_t _NET_WM_VISIBLE_NAME;
89 xcb_atom_t _NET_WM_ICON_NAME;
90 xcb_atom_t _NET_WM_VISIBLE_ICON_NAME;
91 xcb_atom_t _NET_WM_DESKTOP;
92 xcb_atom_t _NET_WM_WINDOW_TYPE;
93 xcb_atom_t _NET_WM_STATE;
94 xcb_atom_t _NET_WM_ALLOWED_ACTIONS;
95 xcb_atom_t _NET_WM_STRUT;
96 xcb_atom_t _NET_WM_STRUT_PARTIAL;
97 xcb_atom_t _NET_WM_ICON_GEOMETRY;
98 xcb_atom_t _NET_WM_ICON;
99 xcb_atom_t _NET_WM_PID;
100 xcb_atom_t _NET_WM_HANDLED_ICONS;
101 xcb_atom_t _NET_WM_USER_TIME;
102 xcb_atom_t _NET_WM_USER_TIME_WINDOW;
103 xcb_atom_t _NET_FRAME_EXTENTS;
104 xcb_atom_t _NET_WM_PING;
105 xcb_atom_t _NET_WM_SYNC_REQUEST;
106 xcb_atom_t _NET_WM_SYNC_REQUEST_COUNTER;
107 xcb_atom_t _NET_WM_FULLSCREEN_MONITORS;
108 xcb_atom_t _NET_WM_FULL_PLACEMENT;
109 xcb_atom_t UTF8_STRING;
110 xcb_atom_t WM_PROTOCOLS;
111 xcb_atom_t MANAGER;
112 xcb_atom_t _NET_WM_WINDOW_TYPE_DESKTOP;
113 xcb_atom_t _NET_WM_WINDOW_TYPE_DOCK;
114 xcb_atom_t _NET_WM_WINDOW_TYPE_TOOLBAR;
115 xcb_atom_t _NET_WM_WINDOW_TYPE_MENU;
116 xcb_atom_t _NET_WM_WINDOW_TYPE_UTILITY;
117 xcb_atom_t _NET_WM_WINDOW_TYPE_SPLASH;
118 xcb_atom_t _NET_WM_WINDOW_TYPE_DIALOG;
119 xcb_atom_t _NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
120 xcb_atom_t _NET_WM_WINDOW_TYPE_POPUP_MENU;
121 xcb_atom_t _NET_WM_WINDOW_TYPE_TOOLTIP;
122 xcb_atom_t _NET_WM_WINDOW_TYPE_NOTIFICATION;
123 xcb_atom_t _NET_WM_WINDOW_TYPE_COMBO;
124 xcb_atom_t _NET_WM_WINDOW_TYPE_DND;
125 xcb_atom_t _NET_WM_WINDOW_TYPE_NORMAL;
126 xcb_atom_t _NET_WM_STATE_MODAL;
127 xcb_atom_t _NET_WM_STATE_STICKY;
128 xcb_atom_t _NET_WM_STATE_MAXIMIZED_VERT;
129 xcb_atom_t _NET_WM_STATE_MAXIMIZED_HORZ;
130 xcb_atom_t _NET_WM_STATE_SHADED;
131 xcb_atom_t _NET_WM_STATE_SKIP_TASKBAR;
132 xcb_atom_t _NET_WM_STATE_SKIP_PAGER;
133 xcb_atom_t _NET_WM_STATE_HIDDEN;
134 xcb_atom_t _NET_WM_STATE_FULLSCREEN;
135 xcb_atom_t _NET_WM_STATE_ABOVE;
136 xcb_atom_t _NET_WM_STATE_BELOW;
137 xcb_atom_t _NET_WM_STATE_DEMANDS_ATTENTION;
138 xcb_atom_t _NET_WM_ACTION_MOVE;
139 xcb_atom_t _NET_WM_ACTION_RESIZE;
140 xcb_atom_t _NET_WM_ACTION_MINIMIZE;
141 xcb_atom_t _NET_WM_ACTION_SHADE;
142 xcb_atom_t _NET_WM_ACTION_STICK;
143 xcb_atom_t _NET_WM_ACTION_MAXIMIZE_HORZ;
144 xcb_atom_t _NET_WM_ACTION_MAXIMIZE_VERT;
145 xcb_atom_t _NET_WM_ACTION_FULLSCREEN;
146 xcb_atom_t _NET_WM_ACTION_CHANGE_DESKTOP;
147 xcb_atom_t _NET_WM_ACTION_CLOSE;
148 xcb_atom_t _NET_WM_ACTION_ABOVE;
149 xcb_atom_t _NET_WM_ACTION_BELOW;
150} xcb_ewmh_connection_t;
151
152/**
153 * @brief Hold a GetProperty reply containing a list of Atoms
154 */
155typedef struct {
156 /** The number of Atoms */
157 uint32_t atoms_len;
158 /** The list of Atoms */
159 xcb_atom_t *atoms;
160 /** The actual GetProperty reply */
161 xcb_get_property_reply_t *_reply;
162} xcb_ewmh_get_atoms_reply_t;
163
164/**
165 * @brief Hold a GetProperty reply containing a list of Windows
166 */
167typedef struct {
168 /** The number of Windows */
169 uint32_t windows_len;
170 /** The list of Windows */
171 xcb_window_t *windows;
172 /** The actual GetProperty reply */
173 xcb_get_property_reply_t *_reply;
174} xcb_ewmh_get_windows_reply_t;
175
176/**
177 * @brief Hold a GetProperty reply containg a list of UTF-8 strings
178 */
179typedef struct {
180 /** The number of UTF-8 strings */
181 uint32_t strings_len;
182 /** The list of UTF-8 strings */
183 char *strings;
184 /** The actual GetProperty reply */
185 xcb_get_property_reply_t *_reply;
186} xcb_ewmh_get_utf8_strings_reply_t;
187
188/**
189 * @brief Coordinates Property values
190 */
191typedef struct {
192 /** The x coordinate */
193 uint32_t x;
194 /** The y coordinate */
195 uint32_t y;
196} xcb_ewmh_coordinates_t;
197
198/**
199 * @brief Hold reply of _NET_DESKTOP_VIEWPORT GetProperty
200 */
201typedef struct {
202 /** The number of desktop viewports */
203 uint32_t desktop_viewport_len;
204 /** The desktop viewports */
205 xcb_ewmh_coordinates_t *desktop_viewport;
206 /** The actual GetProperty reply */
207 xcb_get_property_reply_t *_reply;
208} xcb_ewmh_get_desktop_viewport_reply_t;
209
210/**
211 * @brief Geometry Property values
212 */
213typedef struct {
214 /** The x coordinate */
215 uint32_t x;
216 /** The y coordinate */
217 uint32_t y;
218 /** The width */
219 uint32_t width;
220 /** The height */
221 uint32_t height;
222} xcb_ewmh_geometry_t;
223
224/**
225 * @brief Hold reply of a _NET_WORKAREA GetProperty
226 */
227typedef struct {
228 /** The number of desktop workarea */
229 uint32_t workarea_len;
230 /** The list of desktop workarea */
231 xcb_ewmh_geometry_t *workarea;
232 /** The actual GetProperty reply */
233 xcb_get_property_reply_t *_reply;
234} xcb_ewmh_get_workarea_reply_t;
235
236/**
237 * @brief Source indication in requests
238 */
239typedef enum {
240 /** No source at all (for clients supporting an older version of
241 EWMH specification) */
242 XCB_EWMH_CLIENT_SOURCE_TYPE_NONE = 0,
243 /** Normal application */
244 XCB_EWMH_CLIENT_SOURCE_TYPE_NORMAL = 1,
245 /** Pagers and other clients that represent direct user actions */
246 XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER = 2
247} xcb_ewmh_client_source_type_t;
248
249/**
250 * @brief _NET_DESKTOP_LAYOUT orientation
251 */
252typedef enum {
253 /** Horizontal orientation (desktops laid out in rows) */
254 XCB_EWMH_WM_ORIENTATION_HORZ = 0,
255 /** Vertical orientation (desktops laid out in columns) */
256 XCB_EWMH_WM_ORIENTATION_VERT = 1
257} xcb_ewmh_desktop_layout_orientation_t;
258
259/**
260 * @brief _NET_DESKTOP_LAYOUT starting corner
261 */
262typedef enum {
263 /** Starting corner on the top left */
264 XCB_EWMH_WM_TOPLEFT = 0,
265 /** Starting corner on the top right */
266 XCB_EWMH_WM_TOPRIGHT = 1,
267 /** Starting corner on the bottom right */
268 XCB_EWMH_WM_BOTTOMRIGHT = 2,
269 /** Starting corner on the bottom left */
270 XCB_EWMH_WM_BOTTOMLEFT = 3
271} xcb_ewmh_desktop_layout_starting_corner_t;
272
273/**
274 * @brief Hold reply of a _NET_DESKTOP_LAYOUT GetProperty
275 * @see xcb_ewmh_desktop_layout_orientation_t
276 * @see xcb_ewmh_desktop_layout_starting_corner_t
277 */
278typedef struct {
279 /** The desktops orientation */
280 uint32_t orientation;
281 /** The number of columns */
282 uint32_t columns;
283 /** The number of rows */
284 uint32_t rows;
285 /** The desktops starting corner */
286 uint32_t starting_corner;
287} xcb_ewmh_get_desktop_layout_reply_t;
288
289/**
290 * @brief _NET_WM_MOVERESIZE value when moving via keyboard
291 * @see xcb_ewmh_moveresize_direction_t
292 */
293typedef enum {
294 /** The window x coordinate */
295 XCB_EWMH_MOVERESIZE_WINDOW_X = (1 << 8),
296 /** The window y coordinate */
297 XCB_EWMH_MOVERESIZE_WINDOW_Y = (1 << 9),
298 /** The window width */
299 XCB_EWMH_MOVERESIZE_WINDOW_WIDTH = (1 << 10),
300 /** The window height */
301 XCB_EWMH_MOVERESIZE_WINDOW_HEIGHT = (1 << 11)
302} xcb_ewmh_moveresize_window_opt_flags_t;
303
304/**
305 * @brief _NET_WM_MOVERESIZE window movement or resizing
306 */
307typedef enum {
308 /** Resizing applied on the top left edge */
309 XCB_EWMH_WM_MOVERESIZE_SIZE_TOPLEFT = 0,
310 /** Resizing applied on the top edge */
311 XCB_EWMH_WM_MOVERESIZE_SIZE_TOP = 1,
312 /** Resizing applied on the top right edge */
313 XCB_EWMH_WM_MOVERESIZE_SIZE_TOPRIGHT = 2,
314 /** Resizing applied on the right edge */
315 XCB_EWMH_WM_MOVERESIZE_SIZE_RIGHT = 3,
316 /** Resizing applied on the bottom right edge */
317 XCB_EWMH_WM_MOVERESIZE_SIZE_BOTTOMRIGHT = 4,
318 /** Resizing applied on the bottom edge */
319 XCB_EWMH_WM_MOVERESIZE_SIZE_BOTTOM = 5,
320 /** Resizing applied on the bottom left edge */
321 XCB_EWMH_WM_MOVERESIZE_SIZE_BOTTOMLEFT = 6,
322 /** Resizing applied on the left edge */
323 XCB_EWMH_WM_MOVERESIZE_SIZE_LEFT = 7,
324 /* Movement only */
325 XCB_EWMH_WM_MOVERESIZE_MOVE = 8,
326 /* Size via keyboard */
327 XCB_EWMH_WM_MOVERESIZE_SIZE_KEYBOARD = 9,
328 /* Move via keyboard */
329 XCB_EWMH_WM_MOVERESIZE_MOVE_KEYBOARD = 10,
330 /* Cancel operation */
331 XCB_EWMH_WM_MOVERESIZE_CANCEL = 11
332} xcb_ewmh_moveresize_direction_t;
333
334/**
335 * @brief Action on the _NET_WM_STATE property
336 */
337typedef enum {
338 /* Remove/unset property */
339 XCB_EWMH_WM_STATE_REMOVE = 0,
340 /* Add/set property */
341 XCB_EWMH_WM_STATE_ADD = 1,
342 /* Toggle property */
343 XCB_EWMH_WM_STATE_TOGGLE = 2
344} xcb_ewmh_wm_state_action_t;
345
346/**
347 * @brief Hold reply of _NET_WM_STRUT_PARTIAL GetProperty
348 */
349typedef struct {
350 /** Reserved space on the left border of the screen */
351 uint32_t left;
352 /** Reserved space on the right border of the screen */
353 uint32_t right;
354 /** Reserved space on the top border of the screen */
355 uint32_t top;
356 /** Reserved space on the bottom border of the screen */
357 uint32_t bottom;
358 /** Beginning y coordinate of the left strut */
359 uint32_t left_start_y;
360 /** Ending y coordinate of the left strut */
361 uint32_t left_end_y;
362 /** Beginning y coordinate of the right strut */
363 uint32_t right_start_y;
364 /** Ending y coordinate of the right strut */
365 uint32_t right_end_y;
366 /** Beginning x coordinate of the top strut */
367 uint32_t top_start_x;
368 /** Ending x coordinate of the top strut */
369 uint32_t top_end_x;
370 /** Beginning x coordinate of the bottom strut */
371 uint32_t bottom_start_x;
372 /** Ending x coordinate of the bottom strut */
373 uint32_t bottom_end_x;
374} xcb_ewmh_wm_strut_partial_t;
375
376/**
377 * @brief Hold a single icon from reply of _NET_WM_ICON GetProperty
378 */
379typedef struct {
380 /** Icon width */
381 uint32_t width;
382 /** Icon height */
383 uint32_t height;
384 /** Rows, left to right and top to bottom of the CARDINAL ARGB */
385 uint32_t *data;
386 /** Number of icons remaining */
387 unsigned int rem;
388 /** Index of the current icon in the array of icons */
389 unsigned int index;
390} xcb_ewmh_wm_icon_iterator_t;
391
392/**
393 * @brief Hold reply of _NET_WM_ICON GetProperty
394 */
395typedef struct {
396 /** Number of icons */
397 unsigned int num_icons;
398 /** The actual GetProperty reply */
399 xcb_get_property_reply_t *_reply;
400} xcb_ewmh_get_wm_icon_reply_t;
401
402/**
403 * @brief Hold reply of _NET_REQUEST_FRAME_EXTENTS GetProperty
404 */
405typedef struct {
406 /** Width of the left border */
407 uint32_t left;
408 /** Width of the right border */
409 uint32_t right;
410 /** Width of the top border */
411 uint32_t top;
412 /** Width of the bottom border */
413 uint32_t bottom;
414} xcb_ewmh_get_extents_reply_t;
415
416/**
417 * @brief Hold reply of _NET_WM_FULLSCREEN_MONITORS GetProperty
418 */
419typedef struct {
420 /** Monitor whose top edge defines the top edge of the fullscreen
421 window */
422 uint32_t top;
423 /** Monitor whose bottom edge defines the bottom edge of the
424 fullscreen window */
425 uint32_t bottom;
426 /** Monitor whose left edge defines the left edge of the fullscreen
427 window */
428 uint32_t left;
429 /** Monitor whose right edge defines the right edge of the
430 fullscreen window */
431 uint32_t right;
432} xcb_ewmh_get_wm_fullscreen_monitors_reply_t;
433
434/**
435 * @brief Send InternAtom requests for the EWMH atoms and its required atoms
436 *
437 * @param c The connection to the X server
438 * @param ewmh The information relative to EWMH
439 * @param screen_nbr The screen number
440 * @return The cookies corresponding to EWMH atoms
441 */
442xcb_intern_atom_cookie_t *xcb_ewmh_init_atoms(xcb_connection_t *c,
443 xcb_ewmh_connection_t *ewmh);
444
445/**
446 * @brief Process the replies to the screen initialisation requests
447 * previously sent
448 *
449 * @param emwh The information relative to EWMH
450 * @param ewmh_cookies The cookies corresponding to EWMH atoms
451 * @param e Error if any
452 * @return Return 1 on success, 0 otherwise
453 */
454uint8_t xcb_ewmh_init_atoms_replies(xcb_ewmh_connection_t *ewmh,
455 xcb_intern_atom_cookie_t *ewmh_cookies,
456 xcb_generic_error_t **e);
457
458static inline void
459xcb_ewmh_connection_wipe(xcb_ewmh_connection_t *ewmh)
460{
461 free(ewmh->screens);
462 free(ewmh->_NET_WM_CM_Sn);
463}
464
465/**
466 * @brief Send a SendEvent request containing a ClientMessage event
467 *
468 * This function is called by all the xcb_ewmh_request* functions
469 * whose should be used instead of calling directly this function
470 *
471 * @param c The X connection
472 * @param window The window where the action will be applied
473 * @param dest The destination window (usually the root window)
474 * @param atom The type of the message
475 * @param data_len The length of data to be sent
476 * @param data The data to be sent
477 * @return The cookie associated with the SendEvent request
478 */
479xcb_void_cookie_t xcb_ewmh_send_client_message(xcb_connection_t *c,
480 xcb_window_t window,
481 xcb_window_t dest,
482 xcb_atom_t atom,
483 uint32_t data_len,
484 const uint32_t *data);
485
486uint8_t xcb_ewmh_get_window_from_reply(xcb_window_t *window,
487 xcb_get_property_reply_t *r);
488
489uint8_t xcb_ewmh_get_window_reply(xcb_ewmh_connection_t *ewmh,
490 xcb_get_property_cookie_t cookie,
491 xcb_window_t *window,
492 xcb_generic_error_t **e);
493
494uint8_t xcb_ewmh_get_cardinal_from_reply(uint32_t *cardinal,
495 xcb_get_property_reply_t *r);
496
497uint8_t xcb_ewmh_get_cardinal_reply(xcb_ewmh_connection_t *ewmh,
498 xcb_get_property_cookie_t cookie,
499 uint32_t *cardinal,
500 xcb_generic_error_t **e);
501
502/**
503 * @brief Get a list of atoms from a given GetProperty reply whose
504 * type is ATOM
505 *
506 * This function is called by all the xcb_ewmh_get_*_from_reply
507 * functions whose should be used instead of calling it directly.
508 * Indeed, The GetProperty request has been previously sent by the
509 * corresponding xcb_ewmh_get_*.
510 *
511 * @param atoms The atoms list
512 * @param r The reply to get the atoms list from
513 * @return Return 1 on success, 0 otherwise
514 */
515uint8_t xcb_ewmh_get_atoms_from_reply(xcb_ewmh_get_atoms_reply_t *atoms,
516 xcb_get_property_reply_t *r);
517
518/**
519 * @brief Get a list of atoms from the reply of a GetProperty request
520 * whose type is ATOM
521 *
522 * This function is called by all the xcb_ewmh_get_*_reply functions
523 * whose should be used instead of calling it directly. The
524 * GetProperty request has been previously sent by the corresponding
525 * xcb_ewmh_get_*.
526 *
527 * @param ewmh The per-screen EWMH specific information
528 * @param cookie The GetProperty cookie
529 * @param atoms The atoms list
530 * @param e The error if any
531 * @return Return 1 on success, 0 otherwise
532 */
533uint8_t xcb_ewmh_get_atoms_reply(xcb_ewmh_connection_t *ewmh,
534 xcb_get_property_cookie_t cookie,
535 xcb_ewmh_get_atoms_reply_t *atoms,
536 xcb_generic_error_t **e);
537
538/**
539 * @brief Wipe the Atoms list reply
540 *
541 * This function must be called to free the memory allocated for atoms
542 * when the reply is requested in *_reply functions.
543 *
544 * @param data The X reply to be freed
545 */
546void xcb_ewmh_get_atoms_reply_wipe(xcb_ewmh_get_atoms_reply_t *data);
547
548/**
549 * @brief Get a list of atoms from a given GetProperty reply whose
550 * type is WINDOW
551 *
552 * This function is called by all the xcb_ewmh_get_*_from_reply
553 * functions whose should be used instead of calling it directly.
554 * Indeed, The GetProperty request has been previously sent by the
555 * corresponding xcb_ewmh_get_*.
556 *
557 * @param atoms The atoms list
558 * @param r The reply to get the atoms list from
559 * @return Return 1 on success, 0 otherwise
560 */
561uint8_t xcb_ewmh_get_windows_from_reply(xcb_ewmh_get_windows_reply_t *atoms,
562 xcb_get_property_reply_t *r);
563
564uint8_t xcb_ewmh_get_utf8_strings_from_reply(xcb_ewmh_connection_t *ewmh,
565 xcb_ewmh_get_utf8_strings_reply_t *data,
566 xcb_get_property_reply_t *r);
567
568uint8_t xcb_ewmh_get_utf8_strings_reply(xcb_ewmh_connection_t *ewmh,
569 xcb_get_property_cookie_t cookie,
570 xcb_ewmh_get_utf8_strings_reply_t *data,
571 xcb_generic_error_t **e);
572
573/**
574 * @brief Get a list of atoms from the reply of a GetProperty request
575 * whose type is WINDOW
576 *
577 * This function is called by all the xcb_ewmh_get_*_reply functions
578 * whose should be used instead of calling it directly. The
579 * GetProperty request has been previously sent by the corresponding
580 * xcb_ewmh_get_*.
581 *
582 * @param ewmh The per-screen EWMH specific information
583 * @param cookie The GetProperty cookie
584 * @param atoms The atoms list
585 * @param e The error if any
586 * @return Return 1 on success, 0 otherwise
587 */
588uint8_t xcb_ewmh_get_windows_reply(xcb_ewmh_connection_t *ewmh,
589 xcb_get_property_cookie_t cookie,
590 xcb_ewmh_get_windows_reply_t *atoms,
591 xcb_generic_error_t **e);
592
593/**
594 * @brief Wipe the windows list reply
595 *
596 * This function must be called to the free the memory allocated for
597 * windows when the reply is requested in '_reply' functions.
598 *
599 * @param data The X reply to be freed
600 */
601void xcb_ewmh_get_windows_reply_wipe(xcb_ewmh_get_windows_reply_t *data);
602
603/**
604 * @brief Wipe the UTF-8 strings list reply
605 *
606 * This function must be called to the free the memory allocated for
607 * UTF-8 strings when the reply is requested in '_reply' functions.
608 *
609 * @param data The X reply to be freed
610 */
611void xcb_ewmh_get_utf8_strings_reply_wipe(xcb_ewmh_get_utf8_strings_reply_t *data);
612
613/**
614 * @brief Send a ChangeProperty request for _NET_SUPPORTED
615 *
616 * _NET_SUPPORTED, ATOM[]/32
617 *
618 * @param ewmh The per-screen EWMH information
619 * @param screen_nbr The screen number
620 * @param list_len The number of Atoms supported by the WM
621 * @param list The Atoms supported by the WM
622 * @return Cookie associated with the ChangeProperty _NET_SUPPORTED request
623 */
624xcb_void_cookie_t xcb_ewmh_set_supported(xcb_ewmh_connection_t *ewmh,
625 int screen_nbr,
626 uint32_t list_len,
627 xcb_atom_t *list);
628
629/**
630 * @see xcb_ewmh_set_supported
631 */
632xcb_void_cookie_t xcb_ewmh_set_supported_checked(xcb_ewmh_connection_t *ewmh,
633 int screen_nbr,
634 uint32_t list_len,
635 xcb_atom_t *list);
636
637/**
638 * @brief Send GetProperty request to get _NET_SUPPORTED root window
639 * property
640 *
641 * _NET_SUPPORTED, ATOM[]/32
642 *
643 * This property MUST be set by the Window Manager to indicate which
644 * hints it supports. For example: considering _NET_WM_STATE both this
645 * atom and all supported states e.g. _NET_WM_STATE_MODAL,
646 * _NET_WM_STATE_STICKY, would be listed. This assumes that backwards
647 * incompatible changes will not be made to the hints (without being
648 * renamed).
649 *
650 * This form can be used only if the request will cause a reply to be
651 * generated. Any returned error will be placed in the event queue.
652 *
653 * @param ewmh The information relative to EWMH
654 * @param screen_nbr The screen number
655 * @return The _NET_SUPPORTED cookie of the GetProperty request
656 */
657xcb_get_property_cookie_t xcb_ewmh_get_supported_unchecked(xcb_ewmh_connection_t *ewmh,
658 int screen_nbr);
659
660/**
661 * @see xcb_ewmh_get_supported_unchecked
662 */
663xcb_get_property_cookie_t xcb_ewmh_get_supported(xcb_ewmh_connection_t *ewmh,
664 int screen_nbr);
665
666/**
667 * @brief Get the list of supported atoms
668 *
669 * @param supported The list of atoms contained in the reply
670 * @param r GetProperty _NET_SUPPORTED reply
671 */
672static inline uint8_t
673xcb_ewmh_get_supported_from_reply(xcb_ewmh_get_atoms_reply_t *supported,
674 xcb_get_property_reply_t *r)
675{
676 return xcb_ewmh_get_atoms_from_reply(supported, r);
677}
678
679/**
680 * @brief Get reply from the GetProperty _NET_SUPPORTED cookie
681 *
682 * The parameter e supplied to this function must be NULL if
683 * xcb_get_window_supported_unchecked() is used. Otherwise, it stores
684 * the error if any.
685 *
686 * @param ewmh The information relative to EWMH
687 * @param cookie The _NET_SUPPORTED GetProperty request cookie
688 * @param supported The reply to be filled
689 * @param The xcb_generic_error_t supplied
690 * @return Return 1 on success, 0 otherwise
691 */
692static inline uint8_t
693xcb_ewmh_get_supported_reply(xcb_ewmh_connection_t *ewmh,
694 xcb_get_property_cookie_t cookie,
695 xcb_ewmh_get_atoms_reply_t *supported,
696 xcb_generic_error_t **e)
697{
698 return xcb_ewmh_get_atoms_reply(ewmh, cookie, supported, e);
699}
700
701/**
702 * @brief Send a ChangeProperty request for _NET_CLIENT_LIST
703 *
704 * _NET_CLIENT_LIST, WINDOW[]/32
705 *
706 * @param ewmh The per-screen EWMH information
707 * @param screen_nbr The screen number
708 * @param list_len The number of Atoms supported by the WM
709 * @param list The Atoms supported by the WM
710 * @return Cookie associated with the ChangeProperty _NET_CLIENT_LIST request
711 */
712xcb_void_cookie_t xcb_ewmh_set_client_list(xcb_ewmh_connection_t *ewmh,
713 int screen_nbr,
714 uint32_t list_len,
715 xcb_window_t *list);
716
717/**
718 * @see xcb_ewmh_set_client_list
719 */
720xcb_void_cookie_t xcb_ewmh_set_client_list_checked(xcb_ewmh_connection_t *ewmh,
721 int screen_nbr,
722 uint32_t list_len,
723 xcb_window_t *list);
724
725/**
726 * @brief Send GetProperty request to get _NET_CLIENT_LIST root window
727 * property
728 *
729 * This array contains all X Windows managed by the Window
730 * Manager. _NET_CLIENT_LIST has initial mapping order, starting with
731 * the oldest window. This property SHOULD be set and updated by the
732 * Window Manager.
733 *
734 * @param ewmh The information relative to EWMH.
735 * @return The _NET_CLIENT_LIST cookie of the GetProperty request.
736 */
737xcb_get_property_cookie_t xcb_ewmh_get_client_list_unchecked(xcb_ewmh_connection_t *ewmh,
738 int screen_nbr);
739
740/**
741 * @brief Send GetProperty request to get _NET_CLIENT_LIST root window
742 * property
743 *
744 * @see xcb_ewmh_get_client_list_unchecked
745 * @param ewmh The information relative to EWMH.
746 * @return The _NET_CLIENT_LIST cookie of the GetProperty request.
747 */
748xcb_get_property_cookie_t xcb_ewmh_get_client_list(xcb_ewmh_connection_t *ewmh,
749 int screen_nbr);
750
751/**
752 * @brief Get the list of client windows from a GetProperty
753 * _NET_CLIENT_LIST reply
754 *
755 * @param clients The list of clients contained in the reply
756 * @param r GetProperty _NET_CLIENT_LIST reply
757 */
758static inline uint8_t
759xcb_ewmh_get_client_list_from_reply(xcb_ewmh_get_windows_reply_t *clients,
760 xcb_get_property_reply_t *r)
761{
762 return xcb_ewmh_get_windows_from_reply(clients, r);
763}
764
765/**
766 * @brief Get reply from the GetProperty _NET_CLIENT_LIST cookie
767 *
768 * The parameter e supplied to this function must be NULL if
769 * xcb_get_window_client_list_unchecked() is used. Otherwise, it
770 * stores the error if any.
771 *
772 * @param ewmh The information relative to EWMH
773 * @param cookie The _NET_CLIENT_LIST GetProperty request cookie
774 * @param clients The list of clients to be filled
775 * @param The xcb_generic_error_t supplied
776 * @return Return 1 on success, 0 otherwise
777 */
778static inline uint8_t
779xcb_ewmh_get_client_list_reply(xcb_ewmh_connection_t *ewmh,
780 xcb_get_property_cookie_t cookie,
781 xcb_ewmh_get_windows_reply_t *clients,
782 xcb_generic_error_t **e)
783{
784 return xcb_ewmh_get_windows_reply(ewmh, cookie, clients, e);
785}
786
787/**
788 * @brief Send a ChangeProperty request for _NET_CLIENT_LIST_STACKING
789 *
790 * _NET_CLIENT_LIST_STACKING, WINDOW[]/32
791 *
792 * @param ewmh The per-screen EWMH information
793 * @param screen_nbr The screen number
794 * @param list_len The number of Atoms supported by the WM
795 * @param list The Atoms supported by the WM
796 * @return Cookie associated with the ChangeProperty _NET_CLIENT_LIST_STACKING request
797 */
798xcb_void_cookie_t xcb_ewmh_set_client_list_stacking(xcb_ewmh_connection_t *ewmh,
799 int screen_nbr,
800 uint32_t list_len,
801 xcb_window_t *list);
802
803/**
804 * @see xcb_ewmh_set_client_list_stacking
805 */
806xcb_void_cookie_t xcb_ewmh_set_client_list_stacking_checked(xcb_ewmh_connection_t *ewmh,
807 int screen_nbr,
808 uint32_t list_len,
809 xcb_window_t *list);
810
811/**
812 * @brief Send GetProperty request to get _NET_CLIENT_LIST_STACKING
813 * root window property
814 *
815 * This array contains all X Windows managed by the Window
816 * Manager. _NET_CLIENT_LIST_STACKING has initial mapping order,
817 * starting with the oldest window. This property SHOULD be set and
818 * updated by the Window Manager.
819 *
820 * @param ewmh The information relative to EWMH
821 * @return The _NET_CLIENT_LIST_STACKING cookie of the GetProperty request
822 */
823xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking_unchecked(xcb_ewmh_connection_t *ewmh,
824 int screen_nbr);
825
826/**
827 * @see xcb_ewmh_get_client_list_unchecked
828 */
829xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking(xcb_ewmh_connection_t *ewmh,
830 int screen_nbr);
831
832/**
833 * @brief Get the list of client windows from a GetProperty
834 * _NET_CLIENT_LIST_STACKING reply
835 *
836 * @param clients The list of clients contained in the reply
837 * @param r GetProperty _NET_CLIENT_LIST_STACKING reply
838 */
839static inline uint8_t
840xcb_ewmh_get_client_list_stacking_from_reply(xcb_ewmh_get_windows_reply_t *clients,
841 xcb_get_property_reply_t *r)
842{
843 return xcb_ewmh_get_windows_from_reply(clients, r);
844}
845
846/**
847 * @brief Get reply from the GetProperty _NET_CLIENT_LIST_STACKING
848 * cookie
849 *
850 * The parameter e supplied to this function must be NULL if
851 * xcb_get_window_client_list_stacking_unchecked() is used.
852 * Otherwise, it stores the error if any.
853 *
854 * @param ewmh The information relative to EWMH
855 * @param cookie The _NET_CLIENT_LIST_STACKING GetProperty request cookie
856 * @param clients The list of clients to be filled
857 * @param The xcb_generic_error_t supplied
858 * @return Return 1 on success, 0 otherwise
859 */
860static inline uint8_t
861xcb_ewmh_get_client_list_stacking_reply(xcb_ewmh_connection_t *ewmh,
862 xcb_get_property_cookie_t cookie,
863 xcb_ewmh_get_windows_reply_t *clients,
864 xcb_generic_error_t **e)
865{
866 return xcb_ewmh_get_windows_reply(ewmh, cookie, clients, e);
867}
868
869/**
870 * @brief Send a ChangeProperty request for _NET_NUMBER_OF_DESKTOPS
871 *
872 * _NET_NUMBER_OF_DESKTOPS? CARDINAL/32
873 *
874 * @param ewmh The per-screen EWMH information
875 * @param screen_nbr The screen number
876 * @param number_of_desktops The number of desktops
877 * @return Cookie associated with the ChangeProperty _NET_NUMBER_OF_DESKTOPS request
878 */
879xcb_void_cookie_t xcb_ewmh_set_number_of_desktops(xcb_ewmh_connection_t *ewmh,
880 int screen_nbr,
881 uint32_t number_of_desktops);
882
883/**
884 * @see xcb_ewmh_set_number_of_desktops
885 */
886xcb_void_cookie_t xcb_ewmh_set_number_of_desktops_checked(xcb_ewmh_connection_t *ewmh,
887 int screen_nbr,
888 uint32_t number_of_desktops);
889
890/**
891 * @brief Send GetProperty request to get _NET_NUMBER_OF_DESKTOPS root
892 * window property
893 *
894 * @param ewmh The information relative to EWMH
895 * @param screen_nbr The screen number
896 * @return The _NET_NUMBER_OF_DESKTOPS cookie of the GetProperty request.
897 */
898xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops_unchecked(xcb_ewmh_connection_t *ewmh,
899 int screen_nbr);
900
901/**
902 * @see xcb_ewmh_get_number_of_desktops_unchecked
903 */
904xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops(xcb_ewmh_connection_t *ewmh,
905 int screen_nbr);
906
907/**
908 * @brief Get the list of client windows from a GetProperty
909 * _NET_NUMBER_OF_DESKTOPS reply
910 *
911 * @param clients The list of clients contained in the reply
912 * @param r GetProperty _NET_NUMBER_OF_DESKTOPS reply
913 * @return Return 1 on success, 0 otherwise
914 */
915static inline uint8_t
916xcb_ewmh_get_number_of_desktops_from_reply(uint32_t *number_of_desktops,
917 xcb_get_property_reply_t *r)
918{
919 return xcb_ewmh_get_cardinal_from_reply(number_of_desktops, r);
920}
921
922/**
923 * @brief Get reply from the GetProperty _NET_NUMBER_OF_DESKTOPS cookie
924 *
925 * The parameter e supplied to this function must be NULL if
926 * xcb_get_window_number_of_desktops_unchecked() is used. Otherwise,
927 * it stores the error if any.
928 *
929 * @param ewmh The information relative to EWMH
930 * @param cookie The _NET_NUMBER_OF_DESKTOPS GetProperty request cookie
931 * @param supported The reply to be filled
932 * @param The xcb_generic_error_t supplied
933 * @return Return 1 on success, 0 otherwise
934 */
935static inline uint8_t
936xcb_ewmh_get_number_of_desktops_reply(xcb_ewmh_connection_t *ewmh,
937 xcb_get_property_cookie_t cookie,
938 uint32_t *number_of_desktops,
939 xcb_generic_error_t **e)
940{
941 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, number_of_desktops, e);
942}
943
944static inline xcb_void_cookie_t
945xcb_ewmh_request_change_number_of_desktops(xcb_ewmh_connection_t *ewmh,
946 int screen_nbr,
947 uint32_t new_number_of_desktops)
948{
949 return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE,
950 ewmh->screens[screen_nbr]->root,
951 ewmh->_NET_NUMBER_OF_DESKTOPS,
952 sizeof(new_number_of_desktops),
953 &new_number_of_desktops);
954}
955
956/**
957 * @brief Send a ChangeProperty request for _NET_DESKTOP_GEOMETRY
958 *
959 * _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32
960 *
961 * @param ewmh The per-screen EWMH information
962 * @param screen_nbr The screen number
963 * @param new_width The new desktop width
964 * @param new_height The new desktop height
965 * @return Cookie associated with the ChangeProperty _NET_DESKTOP_GEOMETRY request
966 */
967xcb_void_cookie_t xcb_ewmh_set_desktop_geometry(xcb_ewmh_connection_t *ewmh,
968 int screen_nbr,
969 uint32_t new_width,
970 uint32_t new_height);
971
972/**
973 * @see xcb_ewmh_set_desktop_geometry
974 */
975xcb_void_cookie_t xcb_ewmh_set_desktop_geometry_checked(xcb_ewmh_connection_t *ewmh,
976 int screen_nbr,
977 uint32_t new_width,
978 uint32_t new_height);
979
980/**
981 * @brief Send GetProperty request to get _NET_DESKTOP_GEOMETRY root
982 * window property
983 *
984 * @param ewmh The information relative to EWMH
985 * @param screen_nbr The screen number
986 * @return The _NET_DESKTOP_GEOMETRY cookie of the GetProperty request
987 */
988xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry_unchecked(xcb_ewmh_connection_t *ewmh,
989 int screen_nbr);
990
991/**
992 * @see xcb_ewmh_get_desktop_geometry_unchecked
993 */
994xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry(xcb_ewmh_connection_t *ewmh,
995 int screen_nbr);
996
997/**
998 * @brief Send ClientMessage requesting to change the _NET_DESKTOP_GEOMETRY
999 *
1000 * @param ewmh The per-screen EWMH information
1001 * @param screen_nbr The screen number
1002 * @param new_width The new desktop width
1003 * @param new_height The new desktop height
1004 * @return The SendEvent cookie
1005 */
1006xcb_void_cookie_t xcb_ewmh_request_change_desktop_geometry(xcb_ewmh_connection_t *ewmh,
1007 int screen_nbr,
1008 uint32_t new_width,
1009 uint32_t new_height);
1010
1011/**
1012 * @brief Get the desktop geometry from a GetProperty
1013 * _NET_DESKTOP_GEOMETRY reply
1014 *
1015 * @param width The current desktop width
1016 * @param height The current desktop height
1017 * @param r GetProperty _NET_DESKTOP_GEOMETRY reply
1018 * @return Return 1 on success, 0 otherwise
1019 */
1020uint8_t xcb_ewmh_get_desktop_geometry_from_reply(uint32_t *width,
1021 uint32_t *height,
1022 xcb_get_property_reply_t *r);
1023
1024/**
1025 * @brief Get reply from the GetProperty _NET_DESKTOP_GEOMETRY cookie
1026 *
1027 * The parameter e supplied to this function must be NULL if
1028 * xcb_get_desktop_geometry_unchecked() is used. Otherwise, it stores
1029 * the error if any.
1030 *
1031 * @param ewmh The information relative to EWMH
1032 * @param cookie The _NET_DESKTOP_GEOMETRY GetProperty request cookie
1033 * @param width The current desktop width
1034 * @param width The current desktop height
1035 * @param The xcb_generic_error_t supplied
1036 * @return Return 1 on success, 0 otherwise
1037 */
1038uint8_t xcb_ewmh_get_desktop_geometry_reply(xcb_ewmh_connection_t *ewmh,
1039 xcb_get_property_cookie_t cookie,
1040 uint32_t *width, uint32_t *height,
1041 xcb_generic_error_t **e);
1042
1043/**
1044 * @brief Send a ChangeProperty request for _NET_DESKTOP_VIEWPORT
1045 *
1046 * _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
1047 *
1048 * @param ewmh The per-screen EWMH information
1049 * @param screen_nbr The screen number
1050 * @param list_len The number of desktop viewports
1051 * @param list The desktop viewports
1052 * @return Cookie associated with the ChangeProperty _NET_DESKTOP_VIEWPORT request
1053 */
1054xcb_void_cookie_t xcb_ewmh_set_desktop_viewport(xcb_ewmh_connection_t *ewmh,
1055 int screen_nbr,
1056 uint32_t list_len,
1057 xcb_ewmh_coordinates_t *list);
1058
1059/**
1060 * @see xcb_ewmh_set_desktop_viewport
1061 */
1062xcb_void_cookie_t xcb_ewmh_set_desktop_viewport_checked(xcb_ewmh_connection_t *ewmh,
1063 int screen_nbr,
1064 uint32_t list_len,
1065 xcb_ewmh_coordinates_t *list);
1066
1067/**
1068 * @brief Send GetProperty request to get _NET_DESKTOP_VIEWPORT root
1069 * window property
1070 *
1071 * @param ewmh The information relative to EWMH
1072 * @param screen_nbr The screen number
1073 * @return The _NET_DESKTOP_VIEWPORT cookie of the GetProperty request
1074 */
1075xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport_unchecked(xcb_ewmh_connection_t *ewmh,
1076 int screen_nbr);
1077
1078/**
1079 * @see xcb_ewmh_get_desktop_viewport_unchecked
1080 */
1081xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport(xcb_ewmh_connection_t *ewmh,
1082 int screen_nbr);
1083
1084/**
1085 * @brief Send ClientMessage requesting to change the _NET_DESKTOP_VIEWPORT
1086 *
1087 * @param ewmh The per-screen EWMH information
1088 * @param screen_nbr The screen number
1089 * @param new_x The new x coordinate
1090 * @param new_y The new y coordinate
1091 * @return The SendEvent cookie
1092 */
1093xcb_void_cookie_t xcb_ewmh_request_change_desktop_viewport(xcb_ewmh_connection_t *ewmh,
1094 int screen_nbr,
1095 uint32_t x, uint32_t y);
1096
1097/**
1098 * @brief Get the desktop geometry from a GetProperty
1099 * _NET_DESKTOP_VIEWPORT reply
1100 *
1101 * @param vp The current desktop viewports
1102 * @param r GetProperty _NET_DESKTOP_VIEWPORT reply
1103 * @return Return 1 on success, 0 otherwise
1104 */
1105uint8_t xcb_ewmh_get_desktop_viewport_from_reply(xcb_ewmh_get_desktop_viewport_reply_t *vp,
1106 xcb_get_property_reply_t *r);
1107
1108/**
1109 * @brief Get reply from the GetProperty _NET_DESKTOP_VIEWPORT cookie
1110 *
1111 * The parameter e supplied to this function must be NULL if
1112 * xcb_get_desktop_viewport_unchecked() is used. Otherwise, it stores
1113 * the error if any.
1114 *
1115 * @param ewmh The information relative to EWMH
1116 * @param cookie The _NET_DESKTOP_VIEWPORT GetProperty request cookie
1117 * @param vp The current desktop viewports
1118 * @param The xcb_generic_error_t supplied
1119 * @return Return 1 on success, 0 otherwise
1120 */
1121uint8_t xcb_ewmh_get_desktop_viewport_reply(xcb_ewmh_connection_t *ewmh,
1122 xcb_get_property_cookie_t cookie,
1123 xcb_ewmh_get_desktop_viewport_reply_t *vp,
1124 xcb_generic_error_t **e);
1125
1126/**
1127 * @brief Wipe the desktop viewports list reply
1128 *
1129 * This function must be called to free the memory allocated for atoms
1130 * when the reply is requested in xcb_ewmh_get_desktop_viewport_reply
1131 * function.
1132 *
1133 * @param r The X reply to be freed
1134 */
1135void xcb_ewmh_get_desktop_viewport_reply_wipe(xcb_ewmh_get_desktop_viewport_reply_t *r);
1136
1137/**
1138 * @brief Send a ChangeProperty request for _NET_CURRENT_DESKTOP
1139 *
1140 * _NET_CURRENT_DESKTOP desktop, CARDINAL/32
1141 *
1142 * @param ewmh The per-screen EWMH information
1143 * @param screen_nbr The screen number
1144 * @param new_current_desktop The new current desktop
1145 * @return Cookie associated with the ChangeProperty _NET_CURRENT_DESKTOP request
1146 */
1147xcb_void_cookie_t xcb_ewmh_set_current_desktop(xcb_ewmh_connection_t *ewmh,
1148 int screen_nbr,
1149 uint32_t new_current_desktop);
1150
1151/**
1152 * @see xcb_ewmh_set_current_desktop
1153 */
1154xcb_void_cookie_t xcb_ewmh_set_current_desktop_checked(xcb_ewmh_connection_t *ewmh,
1155 int screen_nbr,
1156 uint32_t new_current_desktop);
1157
1158/**
1159 * @brief Send GetProperty request to get _NET_CURRENT_DESKTOP root
1160 * window property
1161 *
1162 * @param ewmh The information relative to EWMH
1163 * @param screen_nbr The screen number
1164 * @return The _NET_CURRENT_DESKTOP cookie of the GetProperty request
1165 */
1166xcb_get_property_cookie_t xcb_ewmh_get_current_desktop_unchecked(xcb_ewmh_connection_t *ewmh,
1167 int screen_nbr);
1168
1169/**
1170 * @see xcb_ewmh_get_current_desktop_unchecked
1171 */
1172xcb_get_property_cookie_t xcb_ewmh_get_current_desktop(xcb_ewmh_connection_t *ewmh,
1173 int screen_nbr);
1174
1175/**
1176 * @brief Send ClientMessage requesting to change the _NET_CURRENT_DESKTOP
1177 *
1178 * @param ewmh The per-screen EWMH information
1179 * @param screen_nbr The screen number
1180 * @param new_desktop The new current desktop
1181 * @param timestamp The request timestamp
1182 * @return The SendEvent cookie
1183 */
1184xcb_void_cookie_t xcb_ewmh_request_change_current_desktop(xcb_ewmh_connection_t *ewmh,
1185 int screen_nbr,
1186 uint32_t new_desktop,
1187 xcb_timestamp_t timestamp);
1188
1189/**
1190 * @brief Get the desktop geometry from a GetProperty
1191 * _NET_CURRENT_DESKTOP reply
1192 *
1193 * @param current_desktop The current desktop
1194 * @param r GetProperty _NET_CURRENT_DESKTOP reply
1195 * @return Return 1 on success, 0 otherwise
1196 */
1197static inline uint8_t
1198xcb_ewmh_get_current_desktop_from_reply(uint32_t *current_desktop,
1199 xcb_get_property_reply_t *r)
1200{
1201 return xcb_ewmh_get_cardinal_from_reply(current_desktop, r);
1202}
1203
1204/**
1205 * @brief Get reply from the GetProperty _NET_CURRENT_DESKTOP cookie
1206 *
1207 * The parameter e supplied to this function must be NULL if
1208 * xcb_get_current_desktop_unchecked() is used. Otherwise, it stores
1209 * the error if any.
1210 *
1211 * @param ewmh The information relative to EWMH
1212 * @param cookie The _NET_CURRENT_DESKTOP GetProperty request cookie
1213 * @param vp The current desktop
1214 * @param The xcb_generic_error_t supplied
1215 * @return Return 1 on success, 0 otherwise
1216 */
1217static inline uint8_t
1218xcb_ewmh_get_current_desktop_reply(xcb_ewmh_connection_t *ewmh,
1219 xcb_get_property_cookie_t cookie,
1220 uint32_t *current_desktop,
1221 xcb_generic_error_t **e)
1222{
1223 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, current_desktop, e);
1224}
1225
1226/**
1227 * @brief Send a ChangeProperty request for _NET_DESKTOP_NAMES
1228 *
1229 * _NET_DESKTOP_NAMES, UTF8_STRING[]
1230 *
1231 * @param ewmh The per-screen EWMH information
1232 * @param screen_nbr The screen number
1233 * @param strings_len The number of desktop names
1234 * @param strings The desktop names
1235 * @return Cookie associated with the ChangeProperty _NET_DESKTOP_NAMES request
1236 */
1237xcb_void_cookie_t xcb_ewmh_set_desktop_names(xcb_ewmh_connection_t *ewmh,
1238 int screen_nbr,
1239 uint32_t strings_len,
1240 const char *strings);
1241
1242/**
1243 * @see xcb_ewmh_set_desktop_names
1244 */
1245xcb_void_cookie_t xcb_ewmh_set_desktop_names_checked(xcb_ewmh_connection_t *ewmh,
1246 int screen_nbr,
1247 uint32_t strings_len,
1248 const char *strings);
1249
1250/**
1251 * @brief Send GetProperty request to get _NET_DESKTOP_NAMES root
1252 * window property
1253 *
1254 * @param ewmh The information relative to EWMH
1255 * @return The _NET_DESKTOP_NAMES cookie of the GetProperty request
1256 */
1257xcb_get_property_cookie_t xcb_ewmh_get_desktop_names_unchecked(xcb_ewmh_connection_t *ewmh,
1258 int screen_nbr);
1259
1260/**
1261 * @see xcb_ewmh_get_desktop_names_unchecked
1262 */
1263xcb_get_property_cookie_t xcb_ewmh_get_desktop_names(xcb_ewmh_connection_t *ewmh,
1264 int screen_nbr);
1265
1266/**
1267 * @brief Get the desktop geometry from a GetProperty
1268 * _NET_DESKTOP_NAMES reply
1269 *
1270 * @param ewmh The information relative to EWMH
1271 * @param names The desktop names
1272 * @param r GetProperty _NET_DESKTOP_NAMES reply
1273 * @return Return 1 on success, 0 otherwise
1274 */
1275static inline uint8_t
1276xcb_ewmh_get_desktop_names_from_reply(xcb_ewmh_connection_t *ewmh,
1277 xcb_ewmh_get_utf8_strings_reply_t *names,
1278 xcb_get_property_reply_t *r)
1279{
1280 return xcb_ewmh_get_utf8_strings_from_reply(ewmh, names, r);
1281}
1282
1283/**
1284 * @brief Get reply from the GetProperty _NET_DESKTOP_NAMES cookie
1285 *
1286 * The parameter e supplied to this function must be NULL if
1287 * xcb_get_desktop_names_unchecked() is used. Otherwise, it stores
1288 * the error if any.
1289 *
1290 * @param ewmh The information relative to EWMH
1291 * @param cookie The _NET_DESKTOP_NAMES GetProperty request cookie
1292 * @param names The desktop names
1293 * @param The xcb_generic_error_t supplied
1294 * @return Return 1 on success, 0 otherwise
1295 */
1296static inline uint8_t
1297xcb_ewmh_get_desktop_names_reply(xcb_ewmh_connection_t *ewmh,
1298 xcb_get_property_cookie_t cookie,
1299 xcb_ewmh_get_utf8_strings_reply_t *names,
1300 xcb_generic_error_t **e)
1301{
1302 return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, names, e);
1303}
1304
1305/**
1306 * @brief Send a ChangeProperty request for _NET_ACTIVE_WINDOW
1307 *
1308 * _NET_ACTIVE_WINDOW, WINDOW/32
1309 *
1310 * @param ewmh The per-screen EWMH information
1311 * @param screen_nbr The screen number
1312 * @param new_active_window The window to make active
1313 * @return Cookie associated with the ChangeProperty _NET_ACTIVE_WINDOW request
1314 */
1315xcb_void_cookie_t xcb_ewmh_set_active_window(xcb_ewmh_connection_t *ewmh,
1316 int screen_nbr,
1317 xcb_window_t new_active_window);
1318
1319/**
1320 * @see xcb_ewmh_set_active_window
1321 */
1322xcb_void_cookie_t xcb_ewmh_set_active_window_checked(xcb_ewmh_connection_t *ewmh,
1323 int screen_nbr,
1324 xcb_window_t new_active_window);
1325
1326/**
1327 * @brief Send ClientMessage requesting to change the _NET_ACTIVE_WINDOW
1328 *
1329 * The window ID of the currently active window or None if no window
1330 * has the focus. This is a read-only property set by the Window
1331 * Manager. If a Client wants to activate another window, it MUST send
1332 * a _NET_ACTIVE_WINDOW client message to the root window. The
1333 * timestamp is Client's last user activity timestamp at the time of
1334 * the request, and the currently active window is the Client's active
1335 * toplevel window, if any (the Window Manager may be e.g. more likely
1336 * to obey the request if it will mean transferring focus from one
1337 * active window to another).
1338 *
1339 * @see xcb_ewmh_client_source_type_t
1340 * @param ewmh The information relative to EWMH
1341 * @param screen_nbr The screen number
1342 * @param window_to_active The window ID to activate
1343 * @param source_indication The source indication
1344 * @param timestamp The client's last user activity timestamp
1345 * @param current_active_window The currently active window or None
1346 */
1347xcb_void_cookie_t xcb_ewmh_request_change_active_window(xcb_ewmh_connection_t *ewmh,
1348 int screen_nbr,
1349 xcb_window_t window_to_activate,
1350 xcb_ewmh_client_source_type_t source_indication,
1351 xcb_timestamp_t timestamp,
1352 xcb_window_t current_active_window);
1353
1354/**
1355 * @brief Send GetProperty request to get _NET_ACTIVE_WINDOW root
1356 * window property
1357 *
1358 * The window ID of the currently active window or None if no window
1359 * has the focus. This is a read-only property set by the Window
1360 * Manager. This property SHOULD be set and updated by the Window
1361 * Manager.
1362 *
1363 * This form can be used only if the request will cause a reply to be
1364 * generated. Any returned error will be placed in the event queue.
1365 *
1366 * @param ewmh The information relative to EWMH
1367 * @param screen_nbr The screen number
1368 * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request
1369 */
1370xcb_get_property_cookie_t xcb_ewmh_get_active_window_unchecked(xcb_ewmh_connection_t *ewmh,
1371 int screen_nbr);
1372
1373/**
1374 * @brief Send GetProperty request to get _NET_ACTIVE_WINDOW root
1375 * window property
1376 *
1377 * @see xcb_ewmh_get_active_window_unchecked
1378 * @param ewmh The information relative to EWMH
1379 * @param screen_nbr The screen number
1380 * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request
1381 */
1382xcb_get_property_cookie_t xcb_ewmh_get_active_window(xcb_ewmh_connection_t *ewmh,
1383 int screen_nbr);
1384
1385/**
1386 * @brief Get the list of client windows from a GetProperty
1387 * _NET_ACTIVE_WINDOW reply
1388 *
1389 * @param active_window The current active window
1390 * @param r GetProperty _NET_ACTIVE_WINDOW_OF_DESKTOPS reply
1391 * @return Return 1 on success, 0 otherwise
1392 */
1393static inline uint8_t
1394xcb_ewmh_get_active_window_from_reply(xcb_window_t *active_window,
1395 xcb_get_property_reply_t *r)
1396{
1397 return xcb_ewmh_get_window_from_reply(active_window, r);
1398}
1399
1400/**
1401 * @brief Get reply from the GetProperty _NET_ACTIVE_WINDOW cookie
1402 *
1403 * The parameter e supplied to this function must be NULL if
1404 * xcb_get_active_window_unchecked() is used. Otherwise, it stores
1405 * the error if any.
1406 *
1407 * @param ewmh The information relative to EWMH.
1408 * @param cookie The _NET_ACTIVE_WINDOW GetProperty request cookie.
1409 * @param active_window The reply to be filled.
1410 * @param The xcb_generic_error_t supplied.
1411 * @return Return 1 on success, 0 otherwise.
1412 */
1413static inline uint8_t
1414xcb_ewmh_get_active_window_reply(xcb_ewmh_connection_t *ewmh,
1415 xcb_get_property_cookie_t cookie,
1416 xcb_window_t *active_window,
1417 xcb_generic_error_t **e)
1418{
1419 return xcb_ewmh_get_window_reply(ewmh, cookie, active_window, e);
1420}
1421
1422/**
1423 * @brief Send a ChangeProperty request for _NET_WORKAREA
1424 *
1425 * _NET_WORKAREA, x, y, width, height CARDINAL[][4]/32
1426 *
1427 * @param ewmh The per-screen EWMH information
1428 * @param screen_nbr The screen number
1429 * @param list_len The number of desktops workareas
1430 * @param list The desktops workareas
1431 * @return Cookie associated with the ChangeProperty _NET_WORKAREA request
1432 */
1433xcb_void_cookie_t xcb_ewmh_set_workarea(xcb_ewmh_connection_t *ewmh,
1434 int screen_nbr,
1435 uint32_t list_len,
1436 xcb_ewmh_geometry_t *list);
1437
1438/**
1439 * @see xcb_ewmh_set_workarea
1440 */
1441xcb_void_cookie_t xcb_ewmh_set_workarea_checked(xcb_ewmh_connection_t *ewmh,
1442 int screen_nbr,
1443 uint32_t list_len,
1444 xcb_ewmh_geometry_t *list);
1445
1446/**
1447 * @brief Send GetProperty request to get _NET_WORKAREA root
1448 * window property
1449 *
1450 * @param ewmh The information relative to EWMH
1451 * @param screen_nbr The screen number
1452 * @return The _NET_WORKAREA cookie of the GetProperty request
1453 */
1454xcb_get_property_cookie_t xcb_ewmh_get_workarea_unchecked(xcb_ewmh_connection_t *ewmh,
1455 int screen_nbr);
1456
1457/**
1458 * @see xcb_ewmh_get_virtual_roots_unchecked
1459 */
1460xcb_get_property_cookie_t xcb_ewmh_get_workarea(xcb_ewmh_connection_t *ewmh,
1461 int screen_nbr);
1462
1463/**
1464 * @brief Get the desktop geometry from a GetProperty _NET_WORKAREA
1465 * reply
1466 *
1467 * @param wa The current workarea
1468 * @param r GetProperty _NET_WORKAREA reply
1469 * @return Return 1 on success, 0 otherwise
1470 */
1471uint8_t xcb_ewmh_get_workarea_from_reply(xcb_ewmh_get_workarea_reply_t *wa,
1472 xcb_get_property_reply_t *r);
1473
1474/**
1475 * @brief Get reply from the GetProperty _NET_WORKAREA cookie
1476 *
1477 * The parameter e supplied to this function must be NULL if
1478 * xcb_get_workarea_unchecked() is used. Otherwise, it stores the
1479 * error if any.
1480 *
1481 * @param ewmh The information relative to EWMH
1482 * @param cookie The _NET_WORKAREA GetProperty request cookie
1483 * @param wa The current workareas of desktops
1484 * @param The xcb_generic_error_t supplied
1485 * @return Return 1 on success, 0 otherwise
1486 */
1487uint8_t xcb_ewmh_get_workarea_reply(xcb_ewmh_connection_t *ewmh,
1488 xcb_get_property_cookie_t cookie,
1489 xcb_ewmh_get_workarea_reply_t *wa,
1490 xcb_generic_error_t **e);
1491
1492/**
1493 * @brief Wipe the workarea list reply
1494 *
1495 * This function must be called to free the memory allocated for atoms
1496 * when the reply is requested in xcb_ewmh_get_workarea_reply
1497 * function.
1498 *
1499 * @param r The X reply to be freed
1500 */
1501void xcb_ewmh_get_workarea_reply_wipe(xcb_ewmh_get_workarea_reply_t *r);
1502
1503/**
1504 * @brief Send a ChangeProperty request for _NET_SUPPORTING_WM_CHECK
1505 *
1506 * _NET_SUPPORTING_WM_CHECK, WINDOW/32
1507 *
1508 * @param ewmh The per-screen EWMH information
1509 * @param parent_window The root window or child window created by the WM
1510 * @param child_window The child window created by the WM
1511 * @return Cookie associated with the ChangeProperty _NET_SUPPORTING_WM_CHECK request
1512 */
1513xcb_void_cookie_t xcb_ewmh_set_supporting_wm_check(xcb_ewmh_connection_t *ewmh,
1514 xcb_window_t parent_window,
1515 xcb_window_t child_window);
1516
1517/**
1518 * @see xcb_ewmh_set_supporting_wm_check
1519 */
1520xcb_void_cookie_t xcb_ewmh_set_supporting_wm_check_checked(xcb_ewmh_connection_t *ewmh,
1521 xcb_window_t parent_window,
1522 xcb_window_t child_window);
1523
1524/**
1525 * @brief Send GetProperty request to get _NET_SUPPORTING_WM_CHECK
1526 * root window property
1527 *
1528 * @param ewmh The information relative to EWMH
1529 * @param screen_nbr The screen number
1530 * @return The _NET_SUPPORTING_WM_CHECK cookie of the GetProperty request
1531 */
1532xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check_unchecked(xcb_ewmh_connection_t *ewmh,
1533 xcb_window_t window);
1534
1535/**
1536 * @see xcb_ewmh_get_supporting_wm_check_unchecked
1537 */
1538xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check(xcb_ewmh_connection_t *ewmh,
1539 xcb_window_t window);
1540
1541/**
1542 * @brief Get the list of client windows from a GetProperty
1543 * _NET_SUPPORTING_WM_CHECK reply
1544 *
1545 * @param window The child window created by the WM
1546 * @param r GetProperty _NET_SUPPORTING_WM_CHECK reply
1547 * @return Return 1 on success, 0 otherwise
1548 */
1549static inline uint8_t
1550xcb_ewmh_get_supporting_wm_check_from_reply(xcb_window_t *window,
1551 xcb_get_property_reply_t *r)
1552{
1553 return xcb_ewmh_get_window_from_reply(window, r);
1554}
1555
1556/**
1557 * @brief Get reply from the GetProperty _NET_SUPPORTING_WM_CHECK
1558 * cookie
1559 *
1560 * The parameter e supplied to this function must be NULL if
1561 * xcb_get_supporting_wm_check_unchecked() is used. Otherwise, it
1562 * stores the error if any.
1563 *
1564 * @param ewmh The information relative to EWMH
1565 * @param cookie The _NET_SUPPORTING_WM_CHECK GetProperty request cookie
1566 * @param window The reply to be filled
1567 * @param The xcb_generic_error_t supplied
1568 * @return Return 1 on success, 0 otherwise
1569 */
1570static inline uint8_t
1571xcb_ewmh_get_supporting_wm_check_reply(xcb_ewmh_connection_t *ewmh,
1572 xcb_get_property_cookie_t cookie,
1573 xcb_window_t *window,
1574 xcb_generic_error_t **e)
1575{
1576 return xcb_ewmh_get_window_reply(ewmh, cookie, window, e);
1577}
1578
1579/**
1580 * @brief Send a ChangeProperty request for _NET_VIRTUAL_ROOTS
1581 *
1582 * _NET_VIRTUAL_ROOTS, WINDOW[]/32
1583 *
1584 * @param ewmh The per-screen EWMH information
1585 * @param screen_nbr The screen number
1586 * @param list_len The number of virtual root windows
1587 * @param list The virtual root windows
1588 * @return Cookie associated with the ChangeProperty _NET_VIRTUAL_ROOTS request
1589 */
1590xcb_void_cookie_t xcb_ewmh_set_virtual_roots(xcb_ewmh_connection_t *ewmh,
1591 int screen_nbr,
1592 uint32_t list_len,
1593 xcb_window_t *list);
1594
1595/**
1596 * @see xcb_ewmh_set_virtual_roots
1597 */
1598xcb_void_cookie_t xcb_ewmh_set_virtual_roots_checked(xcb_ewmh_connection_t *ewmh,
1599 int screen_nbr,
1600 uint32_t list_len,
1601 xcb_window_t *list);
1602
1603/**
1604 * @brief Send GetProperty request to get _NET_VIRTUAL_ROOTS root
1605 * window property
1606 *
1607 * @param ewmh The information relative to EWMH
1608 * @param screen_nbr The screen number
1609 * @return The _NET_VIRTUAL_ROOTS cookie of the GetProperty request
1610 */
1611xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots_unchecked(xcb_ewmh_connection_t *ewmh,
1612 int screen_nbr);
1613
1614/**
1615 * @see xcb_ewmh_get_virtual_roots_unchecked
1616 */
1617xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots(xcb_ewmh_connection_t *ewmh,
1618 int screen_nbr);
1619
1620/**
1621 * @brief Get the desktop geometry from a GetProperty _NET_WORKAREA
1622 * reply
1623 *
1624 * @param virtual_roots The current virtual root windows
1625 * @param r GetProperty _NET_VIRTUAL_ROOTS reply
1626 * @return Return 1 on success, 0 otherwise
1627 */
1628static inline uint8_t
1629xcb_ewmh_get_virtual_roots_from_reply(xcb_ewmh_get_windows_reply_t *virtual_roots,
1630 xcb_get_property_reply_t *r)
1631{
1632 return xcb_ewmh_get_windows_from_reply(virtual_roots, r);
1633}
1634
1635/**
1636 * @brief Get reply from the GetProperty _NET_VIRTUAL_ROOTS cookie
1637 *
1638 * The parameter e supplied to this function must be NULL if
1639 * xcb_get_virtual_roots_unchecked() is used. Otherwise, it stores
1640 * the error if any.
1641 *
1642 * @param ewmh The information relative to EWMH
1643 * @param cookie The _NET_VIRTUAL_ROOTS GetProperty request cookie
1644 * @param virtual_roots The current virtual root windows
1645 * @param The xcb_generic_error_t supplied
1646 * @return Return 1 on success, 0 otherwise
1647 */
1648static inline uint8_t
1649xcb_ewmh_get_virtual_roots_reply(xcb_ewmh_connection_t *ewmh,
1650 xcb_get_property_cookie_t cookie,
1651 xcb_ewmh_get_windows_reply_t *virtual_roots,
1652 xcb_generic_error_t **e)
1653{
1654 return xcb_ewmh_get_windows_reply(ewmh, cookie, virtual_roots, e);
1655}
1656
1657xcb_void_cookie_t xcb_ewmh_set_desktop_layout(xcb_ewmh_connection_t *ewmh,
1658 int screen_nbr,
1659 xcb_ewmh_desktop_layout_orientation_t orientation,
1660 uint32_t columns, uint32_t rows,
1661 xcb_ewmh_desktop_layout_starting_corner_t starting_corner);
1662
1663xcb_void_cookie_t xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewmh,
1664 int screen_nbr,
1665 xcb_ewmh_desktop_layout_orientation_t orientation,
1666 uint32_t columns, uint32_t rows,
1667 xcb_ewmh_desktop_layout_starting_corner_t starting_corner);
1668
1669/**
1670 * @brief Send GetProperty request to get _NET_DESKTOP_LAYOUT root
1671 * window property
1672 *
1673 * @param ewmh The information relative to EWMH
1674 * @param screen_nbr The screen number
1675 * @return The _NET_DESKTOP_LAYOUT cookie of the GetProperty request
1676 */
1677xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout_unchecked(xcb_ewmh_connection_t *ewmh,
1678 int screen_nbr);
1679
1680/**
1681 * @see xcb_ewmh_get_desktop_layout_unchecked
1682 */
1683xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout(xcb_ewmh_connection_t *ewmh,
1684 int screen_nbr);
1685
1686uint8_t xcb_ewmh_get_desktop_layout_from_reply(xcb_ewmh_get_desktop_layout_reply_t *desktop_layouts,
1687 xcb_get_property_reply_t *r);
1688
1689uint8_t xcb_ewmh_get_desktop_layout_reply(xcb_ewmh_connection_t *ewmh,
1690 xcb_get_property_cookie_t cookie,
1691 xcb_ewmh_get_desktop_layout_reply_t *desktop_layouts,
1692 xcb_generic_error_t **e);
1693
1694xcb_void_cookie_t xcb_ewmh_set_showing_desktop(xcb_ewmh_connection_t *ewmh,
1695 int screen_nbr,
1696 uint32_t desktop);
1697
1698xcb_void_cookie_t xcb_ewmh_set_showing_desktop_checked(xcb_ewmh_connection_t *ewmh,
1699 int screen_nbr,
1700 uint32_t desktop);
1701
1702xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop_unchecked(xcb_ewmh_connection_t *ewmh,
1703 int screen_nbr);
1704
1705xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop(xcb_ewmh_connection_t *ewmh,
1706 int screen_nbr);
1707
1708static inline uint8_t
1709xcb_ewmh_get_showing_desktop_from_reply(uint32_t *desktop,
1710 xcb_get_property_reply_t *r)
1711{
1712 return xcb_ewmh_get_cardinal_from_reply(desktop, r);
1713}
1714
1715static inline uint8_t
1716xcb_ewmh_get_showing_desktop_reply(xcb_ewmh_connection_t *ewmh,
1717 xcb_get_property_cookie_t cookie,
1718 uint32_t *desktop,
1719 xcb_generic_error_t **e)
1720{
1721 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, desktop, e);
1722}
1723
1724static inline xcb_void_cookie_t
1725xcb_ewmh_request_change_showing_desktop(xcb_ewmh_connection_t *ewmh,
1726 int screen_nbr,
1727 uint32_t enter)
1728{
1729 return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE,
1730 ewmh->screens[screen_nbr]->root,
1731 ewmh->_NET_SHOWING_DESKTOP,
1732 sizeof(enter), &enter);
1733}
1734
1735xcb_void_cookie_t xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh,
1736 int screen_nbr,
1737 xcb_window_t window_to_close,
1738 xcb_timestamp_t timestamp,
1739 xcb_ewmh_client_source_type_t source_indication);
1740
1741xcb_void_cookie_t xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh,
1742 int screen_nbr,
1743 xcb_window_t moveresize_window,
1744 xcb_gravity_t gravity,
1745 xcb_ewmh_client_source_type_t source_indication,
1746 xcb_ewmh_moveresize_window_opt_flags_t flags,
1747 uint32_t x, uint32_t y,
1748 uint32_t width, uint32_t height);
1749
1750xcb_void_cookie_t xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh,
1751 int screen_nbr,
1752 xcb_window_t moveresize_window,
1753 uint32_t x_root, uint32_t y_root,
1754 xcb_ewmh_moveresize_direction_t direction,
1755 xcb_button_index_t button,
1756 xcb_ewmh_client_source_type_t source_indication);
1757
1758xcb_void_cookie_t xcb_ewmh_request_restack_window(xcb_ewmh_connection_t *ewmh,
1759 int screen_nbr,
1760 xcb_window_t window_to_restack,
1761 xcb_window_t sibling_window,
1762 xcb_stack_mode_t detail);
1763
1764static inline xcb_void_cookie_t
1765xcb_ewmh_request_frame_extents(xcb_ewmh_connection_t *ewmh,
1766 int screen_nbr,
1767 xcb_window_t client_window)
1768{
1769 return xcb_ewmh_send_client_message(ewmh->connection, client_window,
1770 ewmh->screens[screen_nbr]->root,
1771 ewmh->_NET_REQUEST_FRAME_EXTENTS, 0, NULL);
1772}
1773
1774xcb_void_cookie_t xcb_ewmh_set_wm_name(xcb_ewmh_connection_t *ewmh,
1775 xcb_window_t window,
1776 uint32_t strings_len,
1777 const char *strings);
1778
1779xcb_void_cookie_t xcb_ewmh_set_wm_name_checked(xcb_ewmh_connection_t *ewmh,
1780 xcb_window_t window,
1781 uint32_t strings_len,
1782 const char *strings);
1783
1784xcb_get_property_cookie_t xcb_ewmh_get_wm_name_unchecked(xcb_ewmh_connection_t *ewmh,
1785 xcb_window_t window);
1786
1787xcb_get_property_cookie_t xcb_ewmh_get_wm_name(xcb_ewmh_connection_t *ewmh,
1788 xcb_window_t window);
1789
1790static inline uint8_t
1791xcb_ewmh_get_wm_name_from_reply(xcb_ewmh_connection_t *ewmh,
1792 xcb_ewmh_get_utf8_strings_reply_t *data,
1793 xcb_get_property_reply_t *r)
1794{
1795 return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r);
1796}
1797
1798static inline uint8_t
1799xcb_ewmh_get_wm_name_reply(xcb_ewmh_connection_t *ewmh,
1800 xcb_get_property_cookie_t cookie,
1801 xcb_ewmh_get_utf8_strings_reply_t *data,
1802 xcb_generic_error_t **e)
1803{
1804 return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e);
1805}
1806
1807xcb_void_cookie_t xcb_ewmh_set_wm_visible_name(xcb_ewmh_connection_t *ewmh,
1808 xcb_window_t window,
1809 uint32_t strings_len,
1810 const char *strings);
1811
1812xcb_void_cookie_t xcb_ewmh_set_wm_visible_name_checked(xcb_ewmh_connection_t *ewmh,
1813 xcb_window_t window,
1814 uint32_t strings_len,
1815 const char *strings);
1816
1817xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_name_unchecked(xcb_ewmh_connection_t *ewmh,
1818 xcb_window_t window);
1819
1820xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_name(xcb_ewmh_connection_t *ewmh,
1821 xcb_window_t window);
1822
1823static inline uint8_t
1824xcb_ewmh_get_wm_visible_name_from_reply(xcb_ewmh_connection_t *ewmh,
1825 xcb_ewmh_get_utf8_strings_reply_t *data,
1826 xcb_get_property_reply_t *r)
1827{
1828 return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r);
1829}
1830
1831static inline uint8_t
1832xcb_ewmh_get_wm_visible_name_reply(xcb_ewmh_connection_t *ewmh,
1833 xcb_get_property_cookie_t cookie,
1834 xcb_ewmh_get_utf8_strings_reply_t *data,
1835 xcb_generic_error_t **e)
1836{
1837 return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e);
1838}
1839
1840xcb_void_cookie_t xcb_ewmh_set_wm_icon_name(xcb_ewmh_connection_t *ewmh,
1841 xcb_window_t window,
1842 uint32_t strings_len,
1843 const char *strings);
1844
1845xcb_void_cookie_t xcb_ewmh_set_wm_icon_name_checked(xcb_ewmh_connection_t *ewmh,
1846 xcb_window_t window,
1847 uint32_t strings_len,
1848 const char *strings);
1849
1850xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_name_unchecked(xcb_ewmh_connection_t *ewmh,
1851 xcb_window_t window);
1852
1853xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_name(xcb_ewmh_connection_t *ewmh,
1854 xcb_window_t window);
1855
1856static inline uint8_t
1857xcb_ewmh_get_wm_icon_name_from_reply(xcb_ewmh_connection_t *ewmh,
1858 xcb_ewmh_get_utf8_strings_reply_t *data,
1859 xcb_get_property_reply_t *r)
1860{
1861 return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r);
1862}
1863
1864static inline uint8_t
1865xcb_ewmh_get_wm_icon_name_reply(xcb_ewmh_connection_t *ewmh,
1866 xcb_get_property_cookie_t cookie,
1867 xcb_ewmh_get_utf8_strings_reply_t *data,
1868 xcb_generic_error_t **e)
1869{
1870 return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e);
1871}
1872
1873xcb_void_cookie_t xcb_ewmh_set_wm_visible_icon_name(xcb_ewmh_connection_t *ewmh,
1874 xcb_window_t window,
1875 uint32_t strings_len,
1876 const char *strings);
1877
1878xcb_void_cookie_t xcb_ewmh_set_wm_visible_icon_name_checked(xcb_ewmh_connection_t *ewmh,
1879 xcb_window_t window,
1880 uint32_t strings_len,
1881 const char *strings);
1882
1883xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_icon_name_unchecked(xcb_ewmh_connection_t *ewmh,
1884 xcb_window_t window);
1885
1886xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_icon_name(xcb_ewmh_connection_t *ewmh,
1887 xcb_window_t window);
1888
1889static inline uint8_t
1890xcb_ewmh_get_wm_visible_icon_name_from_reply(xcb_ewmh_connection_t *ewmh,
1891 xcb_ewmh_get_utf8_strings_reply_t *data,
1892 xcb_get_property_reply_t *r)
1893{
1894 return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r);
1895}
1896
1897static inline uint8_t
1898xcb_ewmh_get_wm_visible_icon_name_reply(xcb_ewmh_connection_t *ewmh,
1899 xcb_get_property_cookie_t cookie,
1900 xcb_ewmh_get_utf8_strings_reply_t *data,
1901 xcb_generic_error_t **e)
1902{
1903 return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e);
1904}
1905
1906xcb_void_cookie_t xcb_ewmh_set_wm_desktop(xcb_ewmh_connection_t *ewmh,
1907 xcb_window_t window,
1908 uint32_t desktop);
1909
1910xcb_void_cookie_t xcb_ewmh_set_wm_desktop_checked(xcb_ewmh_connection_t *ewmh,
1911 xcb_window_t window,
1912 uint32_t desktop);
1913
1914
1915xcb_get_property_cookie_t xcb_ewmh_get_wm_desktop_unchecked(xcb_ewmh_connection_t *ewmh,
1916 xcb_window_t window);
1917
1918xcb_get_property_cookie_t xcb_ewmh_get_wm_desktop(xcb_ewmh_connection_t *ewmh,
1919 xcb_window_t window);
1920
1921static inline uint8_t
1922xcb_ewmh_get_wm_desktop_from_reply(uint32_t *desktop,
1923 xcb_get_property_reply_t *r)
1924{
1925 return xcb_ewmh_get_cardinal_from_reply(desktop, r);
1926}
1927
1928static inline uint8_t
1929xcb_ewmh_get_wm_desktop_reply(xcb_ewmh_connection_t *ewmh,
1930 xcb_get_property_cookie_t cookie,
1931 uint32_t *desktop,
1932 xcb_generic_error_t **e)
1933{
1934 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, desktop, e);
1935}
1936
1937xcb_void_cookie_t xcb_ewmh_request_change_wm_desktop(xcb_ewmh_connection_t *ewmh,
1938 int screen_nbr,
1939 xcb_window_t client_window,
1940 uint32_t new_desktop,
1941 xcb_ewmh_client_source_type_t source_indication);
1942
1943xcb_void_cookie_t xcb_ewmh_set_wm_window_type(xcb_ewmh_connection_t *ewmh,
1944 xcb_window_t window,
1945 uint32_t list_len,
1946 xcb_atom_t *list);
1947
1948xcb_void_cookie_t xcb_ewmh_set_wm_window_type_checked(xcb_ewmh_connection_t *ewmh,
1949 xcb_window_t window,
1950 uint32_t list_len,
1951 xcb_atom_t *list);
1952
1953xcb_get_property_cookie_t xcb_ewmh_get_wm_window_type_unchecked(xcb_ewmh_connection_t *ewmh,
1954 xcb_window_t window);
1955
1956xcb_get_property_cookie_t xcb_ewmh_get_wm_window_type(xcb_ewmh_connection_t *ewmh,
1957 xcb_window_t window);
1958
1959uint8_t xcb_ewmh_get_wm_window_type_from_reply(xcb_ewmh_get_atoms_reply_t *wtypes,
1960 xcb_get_property_reply_t *r);
1961
1962uint8_t xcb_ewmh_get_wm_window_type_reply(xcb_ewmh_connection_t *ewmh,
1963 xcb_get_property_cookie_t cookie,
1964 xcb_ewmh_get_atoms_reply_t *name,
1965 xcb_generic_error_t **e);
1966
1967xcb_void_cookie_t xcb_ewmh_set_wm_state(xcb_ewmh_connection_t *ewmh,
1968 xcb_window_t window,
1969 uint32_t list_len,
1970 xcb_atom_t *list);
1971
1972xcb_void_cookie_t xcb_ewmh_set_wm_state_checked(xcb_ewmh_connection_t *ewmh,
1973 xcb_window_t window,
1974 uint32_t list_len,
1975 xcb_atom_t *list);
1976
1977xcb_get_property_cookie_t xcb_ewmh_get_wm_state_unchecked(xcb_ewmh_connection_t *ewmh,
1978 xcb_window_t window);
1979
1980xcb_get_property_cookie_t xcb_ewmh_get_wm_state(xcb_ewmh_connection_t *ewmh,
1981 xcb_window_t window);
1982
1983uint8_t xcb_ewmh_get_wm_state_from_reply(xcb_ewmh_get_atoms_reply_t *wtypes,
1984 xcb_get_property_reply_t *r);
1985
1986uint8_t xcb_ewmh_get_wm_state_reply(xcb_ewmh_connection_t *ewmh,
1987 xcb_get_property_cookie_t cookie,
1988 xcb_ewmh_get_atoms_reply_t *name,
1989 xcb_generic_error_t **e);
1990
1991xcb_void_cookie_t xcb_ewmh_request_change_wm_state(xcb_ewmh_connection_t *ewmh,
1992 int screen_nbr,
1993 xcb_window_t client_window,
1994 xcb_ewmh_wm_state_action_t action,
1995 xcb_atom_t first_property,
1996 xcb_atom_t second_property,
1997 xcb_ewmh_client_source_type_t source_indication);
1998
1999xcb_void_cookie_t xcb_ewmh_set_wm_allowed_actions(xcb_ewmh_connection_t *ewmh,
2000 xcb_window_t window,
2001 uint32_t list_len,
2002 xcb_atom_t *list);
2003
2004xcb_void_cookie_t xcb_ewmh_set_wm_allowed_actions_checked(xcb_ewmh_connection_t *ewmh,
2005 xcb_window_t window,
2006 uint32_t list_len,
2007 xcb_atom_t *list);
2008
2009xcb_get_property_cookie_t xcb_ewmh_get_wm_allowed_actions_unchecked(xcb_ewmh_connection_t *ewmh,
2010 xcb_window_t window);
2011
2012xcb_get_property_cookie_t xcb_ewmh_get_wm_allowed_actions(xcb_ewmh_connection_t *ewmh,
2013 xcb_window_t window);
2014
2015uint8_t xcb_ewmh_get_wm_allowed_actions_from_reply(xcb_ewmh_get_atoms_reply_t *wtypes,
2016 xcb_get_property_reply_t *r);
2017
2018uint8_t xcb_ewmh_get_wm_allowed_actions_reply(xcb_ewmh_connection_t *ewmh,
2019 xcb_get_property_cookie_t cookie,
2020 xcb_ewmh_get_atoms_reply_t *name,
2021 xcb_generic_error_t **e);
2022
2023xcb_void_cookie_t xcb_ewmh_set_wm_strut(xcb_ewmh_connection_t *ewmh,
2024 xcb_window_t window,
2025 uint32_t left, uint32_t right,
2026 uint32_t top, uint32_t bottom);
2027
2028xcb_void_cookie_t xcb_ewmh_set_wm_strut_checked(xcb_ewmh_connection_t *ewmh,
2029 xcb_window_t window,
2030 uint32_t left, uint32_t right,
2031 uint32_t top, uint32_t bottom);
2032
2033xcb_get_property_cookie_t xcb_ewmh_get_wm_strut_unchecked(xcb_ewmh_connection_t *ewmh,
2034 xcb_window_t window);
2035
2036xcb_get_property_cookie_t xcb_ewmh_get_wm_strut(xcb_ewmh_connection_t *ewmh,
2037 xcb_window_t window);
2038
2039uint8_t xcb_ewmh_get_wm_strut_from_reply(xcb_ewmh_get_extents_reply_t *struts,
2040 xcb_get_property_reply_t *r);
2041
2042uint8_t xcb_ewmh_get_wm_strut_reply(xcb_ewmh_connection_t *ewmh,
2043 xcb_get_property_cookie_t cookie,
2044 xcb_ewmh_get_extents_reply_t *struts,
2045 xcb_generic_error_t **e);
2046
2047xcb_void_cookie_t xcb_ewmh_set_wm_strut_partial(xcb_ewmh_connection_t *ewmh,
2048 xcb_window_t window,
2049 xcb_ewmh_wm_strut_partial_t wm_strut);
2050
2051xcb_void_cookie_t xcb_ewmh_set_wm_strut_partial_checked(xcb_ewmh_connection_t *ewmh,
2052 xcb_window_t window,
2053 xcb_ewmh_wm_strut_partial_t wm_strut);
2054
2055xcb_get_property_cookie_t xcb_ewmh_get_wm_strut_partial_unchecked(xcb_ewmh_connection_t *ewmh,
2056 xcb_window_t window);
2057
2058xcb_get_property_cookie_t xcb_ewmh_get_wm_strut_partial(xcb_ewmh_connection_t *ewmh,
2059 xcb_window_t window);
2060
2061uint8_t xcb_ewmh_get_wm_strut_partial_from_reply(xcb_ewmh_wm_strut_partial_t *struts,
2062 xcb_get_property_reply_t *r);
2063
2064uint8_t xcb_ewmh_get_wm_strut_partial_reply(xcb_ewmh_connection_t *ewmh,
2065 xcb_get_property_cookie_t cookie,
2066 xcb_ewmh_wm_strut_partial_t *struts,
2067 xcb_generic_error_t **e);
2068
2069xcb_void_cookie_t xcb_ewmh_set_wm_icon_geometry(xcb_ewmh_connection_t *ewmh,
2070 xcb_window_t window,
2071 uint32_t left, uint32_t right,
2072 uint32_t top, uint32_t bottom);
2073
2074xcb_void_cookie_t xcb_ewmh_set_wm_icon_geometry_checked(xcb_ewmh_connection_t *ewmh,
2075 xcb_window_t window,
2076 uint32_t left, uint32_t right,
2077 uint32_t top, uint32_t bottom);
2078
2079xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_geometry_unchecked(xcb_ewmh_connection_t *ewmh,
2080 xcb_window_t window);
2081
2082xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_geometry(xcb_ewmh_connection_t *ewmh,
2083 xcb_window_t window);
2084
2085uint8_t xcb_ewmh_get_wm_icon_geometry_from_reply(xcb_ewmh_geometry_t *icons,
2086 xcb_get_property_reply_t *r);
2087
2088uint8_t xcb_ewmh_get_wm_icon_geometry_reply(xcb_ewmh_connection_t *ewmh,
2089 xcb_get_property_cookie_t cookie,
2090 xcb_ewmh_geometry_t *icons,
2091 xcb_generic_error_t **e);
2092
2093/**
2094 * @brief Send ChangeProperty request to set _NET_WM_ICON window
2095 * property. The given data is considered to be already
2096 * prepared, namely that it is an array such as: WIDTH1,
2097 * HEIGHT1, IMG1, WIDTH2, HEIGHT2, IMG2.
2098 *
2099 * If you only want to add or append a single icon, you may
2100 * consider using xcb_ewmh_append_wm_icon_checked which is far
2101 * easier to use.
2102 *
2103 * _NET_WM_ICON CARDINAL[][2+n]/32
2104 *
2105 * @param ewmh The information relative to EWMH
2106 * @param mode ChangeProperty mode (xcb_prop_mode_t)
2107 * @param window The window to set the property on
2108 * @param data_len Length of the data
2109 * @param data The data
2110 */
2111static inline xcb_void_cookie_t
2112xcb_ewmh_set_wm_icon_checked(xcb_ewmh_connection_t *ewmh,
2113 uint8_t mode,
2114 xcb_window_t window,
2115 uint32_t data_len, uint32_t *data)
2116{
2117 return xcb_change_property_checked(ewmh->connection, mode,
2118 window, ewmh->_NET_WM_ICON,
2119 XCB_ATOM_CARDINAL, 32, data_len, data);
2120}
2121
2122/**
2123 * @see xcb_ewmh_set_wm_icon_checked
2124 */
2125static inline xcb_void_cookie_t
2126xcb_ewmh_set_wm_icon(xcb_ewmh_connection_t *ewmh,
2127 uint8_t mode,
2128 xcb_window_t window,
2129 uint32_t data_len, uint32_t *data)
2130{
2131 return xcb_change_property(ewmh->connection, mode, window,
2132 ewmh->_NET_WM_ICON, XCB_ATOM_CARDINAL, 32,
2133 data_len, data);
2134}
2135
2136xcb_void_cookie_t xcb_ewmh_append_wm_icon_checked(xcb_ewmh_connection_t *ewmh,
2137 xcb_window_t window,
2138 uint32_t width, uint32_t height,
2139 uint32_t img_len, uint32_t *img);
2140
2141xcb_void_cookie_t xcb_ewmh_append_wm_icon(xcb_ewmh_connection_t *ewmh,
2142 xcb_window_t window,
2143 uint32_t width, uint32_t height,
2144 uint32_t img_len, uint32_t *img);
2145
2146xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_unchecked(xcb_ewmh_connection_t *ewmh,
2147 xcb_window_t window);
2148
2149xcb_get_property_cookie_t xcb_ewmh_get_wm_icon(xcb_ewmh_connection_t *ewmh,
2150 xcb_window_t window);
2151
2152uint8_t xcb_ewmh_get_wm_icon_from_reply(xcb_ewmh_get_wm_icon_reply_t *wm_icon,
2153 xcb_get_property_reply_t *r);
2154
2155uint8_t xcb_ewmh_get_wm_icon_reply(xcb_ewmh_connection_t *ewmh,
2156 xcb_get_property_cookie_t cookie,
2157 xcb_ewmh_get_wm_icon_reply_t *wm_icon,
2158 xcb_generic_error_t **e);
2159
2160xcb_ewmh_wm_icon_iterator_t xcb_ewmh_get_wm_icon_iterator(const xcb_ewmh_get_wm_icon_reply_t *wm_icon);
2161
2162unsigned int xcb_ewmh_get_wm_icon_length(const xcb_ewmh_get_wm_icon_reply_t *wm_icon);
2163
2164void xcb_ewmh_get_wm_icon_next(xcb_ewmh_wm_icon_iterator_t *iterator);
2165
2166void xcb_ewmh_get_wm_icon_reply_wipe(xcb_ewmh_get_wm_icon_reply_t *wm_icon);
2167
2168xcb_void_cookie_t xcb_ewmh_set_wm_pid(xcb_ewmh_connection_t *ewmh,
2169 xcb_window_t window,
2170 uint32_t pid);
2171
2172xcb_void_cookie_t xcb_ewmh_set_wm_pid_checked(xcb_ewmh_connection_t *ewmh,
2173 xcb_window_t window,
2174 uint32_t pid);
2175
2176xcb_get_property_cookie_t xcb_ewmh_get_wm_pid_unchecked(xcb_ewmh_connection_t *ewmh,
2177 xcb_window_t window);
2178
2179xcb_get_property_cookie_t xcb_ewmh_get_wm_pid(xcb_ewmh_connection_t *ewmh,
2180 xcb_window_t window);
2181
2182static inline uint8_t
2183xcb_ewmh_get_wm_pid_from_reply(uint32_t *pid,
2184 xcb_get_property_reply_t *r)
2185{
2186 return xcb_ewmh_get_cardinal_from_reply(pid, r);
2187}
2188
2189static inline uint8_t
2190xcb_ewmh_get_wm_pid_reply(xcb_ewmh_connection_t *ewmh,
2191 xcb_get_property_cookie_t cookie,
2192 uint32_t *pid,
2193 xcb_generic_error_t **e)
2194{
2195 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, pid, e);
2196}
2197
2198xcb_void_cookie_t xcb_ewmh_set_wm_handled_icons(xcb_ewmh_connection_t *ewmh,
2199 xcb_window_t window,
2200 uint32_t handled_icons);
2201
2202xcb_void_cookie_t xcb_ewmh_set_wm_handled_icons_checked(xcb_ewmh_connection_t *ewmh,
2203 xcb_window_t window,
2204 uint32_t handled_icons);
2205
2206xcb_get_property_cookie_t xcb_ewmh_get_wm_handled_icons_unchecked(xcb_ewmh_connection_t *ewmh,
2207 xcb_window_t window);
2208
2209xcb_get_property_cookie_t xcb_ewmh_get_wm_handled_icons(xcb_ewmh_connection_t *ewmh,
2210 xcb_window_t window);
2211
2212static inline uint8_t
2213xcb_ewmh_get_wm_handled_icons_from_reply(uint32_t *handled_icons,
2214 xcb_get_property_reply_t *r)
2215{
2216 return xcb_ewmh_get_cardinal_from_reply(handled_icons, r);
2217}
2218
2219static inline uint8_t
2220xcb_ewmh_get_wm_handled_icons_reply(xcb_ewmh_connection_t *ewmh,
2221 xcb_get_property_cookie_t cookie,
2222 uint32_t *handled_icons,
2223 xcb_generic_error_t **e)
2224{
2225 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, handled_icons, e);
2226}
2227
2228xcb_void_cookie_t xcb_ewmh_set_wm_user_time(xcb_ewmh_connection_t *ewmh,
2229 xcb_window_t window,
2230 uint32_t xtime);
2231
2232xcb_void_cookie_t xcb_ewmh_set_wm_user_time_checked(xcb_ewmh_connection_t *ewmh,
2233 xcb_window_t window,
2234 uint32_t pid);
2235
2236xcb_get_property_cookie_t xcb_ewmh_get_wm_user_time_unchecked(xcb_ewmh_connection_t *ewmh,
2237 xcb_window_t window);
2238
2239xcb_get_property_cookie_t xcb_ewmh_get_wm_user_time(xcb_ewmh_connection_t *ewmh,
2240 xcb_window_t window);
2241
2242static inline uint8_t
2243xcb_ewmh_get_wm_user_time_from_reply(uint32_t *xtime,
2244 xcb_get_property_reply_t *r)
2245{
2246 return xcb_ewmh_get_cardinal_from_reply(xtime, r);
2247}
2248
2249static inline uint8_t
2250xcb_ewmh_get_wm_user_time_reply(xcb_ewmh_connection_t *ewmh,
2251 xcb_get_property_cookie_t cookie,
2252 uint32_t *xtime,
2253 xcb_generic_error_t **e)
2254{
2255 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, xtime, e);
2256}
2257
2258xcb_void_cookie_t xcb_ewmh_set_wm_user_time_window(xcb_ewmh_connection_t *ewmh,
2259 xcb_window_t window,
2260 uint32_t xtime);
2261
2262xcb_void_cookie_t xcb_ewmh_set_wm_user_time_window_checked(xcb_ewmh_connection_t *ewmh,
2263 xcb_window_t window,
2264 uint32_t pid);
2265
2266xcb_get_property_cookie_t xcb_ewmh_get_wm_user_time_window_unchecked(xcb_ewmh_connection_t *ewmh,
2267 xcb_window_t window);
2268
2269xcb_get_property_cookie_t xcb_ewmh_get_wm_user_time_window(xcb_ewmh_connection_t *ewmh,
2270 xcb_window_t window);
2271
2272static inline uint8_t
2273xcb_ewmh_get_wm_user_time_window_from_reply(uint32_t *xtime,
2274 xcb_get_property_reply_t *r)
2275{
2276 return xcb_ewmh_get_cardinal_from_reply(xtime, r);
2277}
2278
2279static inline uint8_t
2280xcb_ewmh_get_wm_user_time_window_reply(xcb_ewmh_connection_t *ewmh,
2281 xcb_get_property_cookie_t cookie,
2282 uint32_t *xtime,
2283 xcb_generic_error_t **e)
2284{
2285 return xcb_ewmh_get_cardinal_reply(ewmh, cookie, xtime, e);
2286}
2287
2288xcb_void_cookie_t xcb_ewmh_set_frame_extents(xcb_ewmh_connection_t *ewmh,
2289 xcb_window_t window,
2290 uint32_t left, uint32_t right,
2291 uint32_t top, uint32_t bottom);
2292
2293xcb_void_cookie_t xcb_ewmh_set_frame_extents_checked(xcb_ewmh_connection_t *ewmh,
2294 xcb_window_t window,
2295 uint32_t left, uint32_t right,
2296 uint32_t top, uint32_t bottom);
2297
2298xcb_get_property_cookie_t xcb_ewmh_get_frame_extents_unchecked(xcb_ewmh_connection_t *ewmh,
2299 xcb_window_t window);
2300
2301xcb_get_property_cookie_t xcb_ewmh_get_frame_extents(xcb_ewmh_connection_t *ewmh,
2302 xcb_window_t window);
2303
2304uint8_t xcb_ewmh_get_frame_extents_from_reply(xcb_ewmh_get_extents_reply_t *frame_extents,
2305 xcb_get_property_reply_t *r);
2306
2307uint8_t xcb_ewmh_get_frame_extents_reply(xcb_ewmh_connection_t *ewmh,
2308 xcb_get_property_cookie_t cookie,
2309 xcb_ewmh_get_extents_reply_t *frame_extents,
2310 xcb_generic_error_t **e);
2311
2312xcb_void_cookie_t xcb_ewmh_send_wm_ping(xcb_ewmh_connection_t *ewmh,
2313 xcb_window_t window,
2314 xcb_timestamp_t timestamp);
2315
2316xcb_void_cookie_t xcb_ewmh_set_wm_sync_request_counter(xcb_ewmh_connection_t *ewmh,
2317 xcb_window_t window,
2318 xcb_atom_t wm_sync_request_counter_atom,
2319 uint32_t low, uint32_t high);
2320
2321xcb_void_cookie_t xcb_ewmh_set_wm_sync_request_counter_checked(xcb_ewmh_connection_t *ewmh,
2322 xcb_window_t window,
2323 xcb_atom_t wm_sync_request_counter_atom,
2324 uint32_t low, uint32_t high);
2325
2326xcb_get_property_cookie_t xcb_ewmh_get_wm_sync_request_counter_unchecked(xcb_ewmh_connection_t *ewmh,
2327 xcb_window_t window);
2328
2329xcb_get_property_cookie_t xcb_ewmh_get_wm_sync_request_counter(xcb_ewmh_connection_t *ewmh,
2330 xcb_window_t window);
2331
2332uint8_t xcb_ewmh_get_wm_sync_request_counter_from_reply(uint64_t *counter,
2333 xcb_get_property_reply_t *r);
2334
2335uint8_t xcb_ewmh_get_wm_sync_request_counter_reply(xcb_ewmh_connection_t *ewmh,
2336 xcb_get_property_cookie_t cookie,
2337 uint64_t *counter,
2338 xcb_generic_error_t **e);
2339
2340xcb_void_cookie_t xcb_ewmh_send_wm_sync_request(xcb_ewmh_connection_t *ewmh,
2341 xcb_window_t window,
2342 xcb_atom_t wm_protocols_atom,
2343 xcb_atom_t wm_sync_request_atom,
2344 xcb_timestamp_t timestamp,
2345 uint64_t counter);
2346
2347xcb_void_cookie_t xcb_ewmh_set_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh,
2348 xcb_window_t window,
2349 uint32_t top, uint32_t bottom,
2350 uint32_t left, uint32_t right);
2351
2352xcb_void_cookie_t xcb_ewmh_set_wm_fullscreen_monitors_checked(xcb_ewmh_connection_t *ewmh,
2353 xcb_window_t window,
2354 uint32_t top, uint32_t bottom,
2355 uint32_t left, uint32_t right);
2356
2357xcb_get_property_cookie_t xcb_ewmh_get_wm_fullscreen_monitors_unchecked(xcb_ewmh_connection_t *ewmh,
2358 xcb_window_t window);
2359
2360xcb_get_property_cookie_t xcb_ewmh_get_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh,
2361 xcb_window_t window);
2362
2363uint8_t xcb_ewmh_get_wm_fullscreen_monitors_from_reply(xcb_ewmh_get_wm_fullscreen_monitors_reply_t *monitors,
2364 xcb_get_property_reply_t *r);
2365
2366uint8_t xcb_ewmh_get_wm_fullscreen_monitors_reply(xcb_ewmh_connection_t *ewmh,
2367 xcb_get_property_cookie_t cookie,
2368 xcb_ewmh_get_wm_fullscreen_monitors_reply_t *monitors,
2369 xcb_generic_error_t **e);
2370
2371
2372xcb_void_cookie_t xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh,
2373 int screen_nbr,
2374 xcb_window_t window,
2375 uint32_t top, uint32_t bottom,
2376 uint32_t left, uint32_t right,
2377 xcb_ewmh_client_source_type_t source_indication);
2378
2379/**
2380 * @brief Set _NET_WM_CM_Sn ownership to the given window
2381 *
2382 * For each screen they manage, compositing manager MUST acquire
2383 * ownership of a selection named _NET_WM_CM_Sn, where n is the screen
2384 * number.
2385 *
2386 * @param ewmh The information relative to EWMH
2387 * @param screen_nbr The screen number
2388 * @param owner The new owner of _NET_WM_CM_Sn selection
2389 * @param timestamp The client's last user activity timestamp
2390 * @param selection_data1 Optional data described by ICCCM
2391 * @param selection_data2 Optional data described by ICCCM
2392 */
2393xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner(xcb_ewmh_connection_t *ewmh,
2394 int screen_nbr,
2395 xcb_window_t owner,
2396 xcb_timestamp_t timestamp,
2397 uint32_t selection_data1,
2398 uint32_t selection_data2);
2399
2400/**
2401 * @see xcb_ewmh_set_wm_cm_owner
2402 */
2403xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner_checked(xcb_ewmh_connection_t *ewmh,
2404 int screen_nbr,
2405 xcb_window_t owner,
2406 xcb_timestamp_t timestamp,
2407 uint32_t selection_data1,
2408 uint32_t selection_data2);
2409
2410/**
2411 * @brief Send GetSelectOwner request to get the owner of
2412 * _NET_WM_CM_Sn root window property
2413 *
2414 * @param ewmh The information relative to EWMH
2415 * @param screen_nbr The screen number
2416 * @return The _NET_WM_CM_Sn cookie of the GetSelectionOwner request
2417 */
2418xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner_unchecked(xcb_ewmh_connection_t *ewmh,
2419 int screen_nbr);
2420
2421/**
2422 * @see xcb_ewmh_get_wm_cm_owner_unchecked
2423 */
2424xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner(xcb_ewmh_connection_t *ewmh,
2425 int screen_nbr);
2426
2427uint8_t xcb_ewmh_get_wm_cm_owner_from_reply(xcb_window_t *owner,
2428 xcb_get_selection_owner_reply_t *r);
2429
2430/**
2431 * @brief Get reply from the GetProperty _NET_CLIENT_LIST cookie
2432 *
2433 * The parameter e supplied to this function must be NULL if
2434 * xcb_get_window_client_list_unchecked() is used. Otherwise, it
2435 * stores the error if any.
2436 *
2437 * @param ewmh The information relative to EWMH.
2438 * @param cookie The _NET_WM_CM_Sn GetSelectionOwner request cookie.
2439 * @param owner The window ID which owns the selection or None.
2440 * @param The xcb_generic_error_t supplied.
2441 * @return Return 1 on success, 0 otherwise.
2442 */
2443uint8_t xcb_ewmh_get_wm_cm_owner_reply(xcb_ewmh_connection_t *ewmh,
2444 xcb_get_selection_owner_cookie_t cookie,
2445 xcb_window_t *owner,
2446 xcb_generic_error_t **e);
2447
2448#ifdef __cplusplus
2449}
2450#endif
2451
2452/**
2453 * @}
2454 */
2455
2456#endif /* __XCB_EWMH_H__ */