1ecce36beSmrg#ifndef __XCB_ICCCM_H__
2ecce36beSmrg#define __XCB_ICCCM_H__
3ecce36beSmrg
4ecce36beSmrg/*
5ecce36beSmrg * Copyright (C) 2008 Arnaud Fontaine <arnau@debian.org>
6ecce36beSmrg * Copyright (C) 2007-2008 Vincent Torri <vtorri@univ-evry.fr>
7ecce36beSmrg *
8ecce36beSmrg * Permission is hereby granted, free of charge, to any person
9ecce36beSmrg * obtaining a copy of this software and associated documentation
10ecce36beSmrg * files (the "Software"), to deal in the Software without
11ecce36beSmrg * restriction, including without limitation the rights to use, copy,
12ecce36beSmrg * modify, merge, publish, distribute, sublicense, and/or sell copies
13ecce36beSmrg * of the Software, and to permit persons to whom the Software is
14ecce36beSmrg * furnished to do so, subject to the following conditions:
15ecce36beSmrg *
16ecce36beSmrg * The above copyright notice and this permission notice shall be
17ecce36beSmrg * included in all copies or substantial portions of the Software.
18ecce36beSmrg *
19ecce36beSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20ecce36beSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21ecce36beSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22ecce36beSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
23ecce36beSmrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24ecce36beSmrg * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25ecce36beSmrg * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26ecce36beSmrg *
27ecce36beSmrg * Except as contained in this notice, the names of the authors or
28ecce36beSmrg * their institutions shall not be used in advertising or otherwise to
29ecce36beSmrg * promote the sale, use or other dealings in this Software without
30ecce36beSmrg * prior written authorization from the authors.
31ecce36beSmrg */
32ecce36beSmrg
33ecce36beSmrg/**
34ecce36beSmrg * @defgroup xcb__icccm_t XCB ICCCM Functions
35ecce36beSmrg *
36ecce36beSmrg * These functions allow easy handling of the protocol described in the
37ecce36beSmrg * Inter-Client Communication Conventions Manual.
38ecce36beSmrg *
39ecce36beSmrg * @{
40ecce36beSmrg */
41ecce36beSmrg
42ecce36beSmrg#include <xcb/xcb.h>
43ecce36beSmrg#include "xcb_property.h"
44ecce36beSmrg
45ecce36beSmrg#ifdef __cplusplus
46ecce36beSmrgextern "C" {
47ecce36beSmrg#endif
48ecce36beSmrg
49ecce36beSmrg/**
50ecce36beSmrg * @brief TextProperty reply structure.
51ecce36beSmrg */
52ecce36beSmrgtypedef struct {
53ecce36beSmrg  /** Store reply to avoid memory allocation, should normally not be
54ecce36beSmrg      used directly */
55ecce36beSmrg  xcb_get_property_reply_t *_reply;
56ecce36beSmrg  /** Encoding used */
57ecce36beSmrg  xcb_atom_t encoding;
58ecce36beSmrg  /** Length of the name field above */
59ecce36beSmrg  uint32_t name_len;
60ecce36beSmrg  /** Property value */
61ecce36beSmrg  char *name;
62ecce36beSmrg  /** Format, may be 8, 16 or 32 */
63ecce36beSmrg  uint8_t format;
64ecce36beSmrg} xcb_get_text_property_reply_t;
65ecce36beSmrg
66ecce36beSmrg/**
67ecce36beSmrg * @brief Deliver a GetProperty request to the X server.
68ecce36beSmrg * @param c The connection to the X server.
69ecce36beSmrg * @param window Window X identifier.
70ecce36beSmrg * @param property Property atom to get.
71ecce36beSmrg * @return The request cookie.
72ecce36beSmrg *
73ecce36beSmrg * Allow to get a window property, in most case you might want to use
74ecce36beSmrg * above functions to get an ICCCM property for a given window.
75ecce36beSmrg */
76ecce36beSmrgxcb_get_property_cookie_t xcb_get_text_property(xcb_connection_t *c,
77ecce36beSmrg                                                xcb_window_t window,
78ecce36beSmrg                                                xcb_atom_t property);
79ecce36beSmrg
80ecce36beSmrg/**
81ecce36beSmrg * @see xcb_get_text_property()
82ecce36beSmrg */
83ecce36beSmrgxcb_get_property_cookie_t xcb_get_text_property_unchecked(xcb_connection_t *c,
84ecce36beSmrg                                                          xcb_window_t window,
85ecce36beSmrg                                                          xcb_atom_t property);
86ecce36beSmrg
87ecce36beSmrg/**
88ecce36beSmrg * @brief Fill given structure with the property value of a window.
89ecce36beSmrg * @param c The connection to the X server.
90ecce36beSmrg * @param cookie TextProperty request cookie.
91ecce36beSmrg * @param prop TextProperty reply which is to be filled.
92ecce36beSmrg * @param e Error if any.
93ecce36beSmrg * @return Return 1 on success, 0 otherwise.
94ecce36beSmrg *
95ecce36beSmrg * If the function return 0 (failure), the content of prop is unmodified and
96ecce36beSmrg * therefore the structure must not be wiped.
97ecce36beSmrg *
98ecce36beSmrg * The parameter e supplied to this function must be NULL if
99ecce36beSmrg * xcb_get_text_property_unchecked() is used.  Otherwise, it stores
100ecce36beSmrg * the error if any.  prop structure members should be freed by
101ecce36beSmrg * xcb_get_text_property_reply_wipe().
102ecce36beSmrg */
103ecce36beSmrguint8_t xcb_get_text_property_reply(xcb_connection_t *c,
104ecce36beSmrg                                    xcb_get_property_cookie_t cookie,
105ecce36beSmrg                                    xcb_get_text_property_reply_t *prop,
106ecce36beSmrg                                    xcb_generic_error_t **e);
107ecce36beSmrg
108ecce36beSmrg/**
109ecce36beSmrg * @brief Wipe prop structure members previously allocated by
110ecce36beSmrg *        xcb_get_text_property_reply().
111ecce36beSmrg * @param prop prop structure whose members is going to be freed.
112ecce36beSmrg */
113ecce36beSmrgvoid xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop);
114ecce36beSmrg
115ecce36beSmrg/* WM_NAME */
116ecce36beSmrg
117ecce36beSmrg/**
118ecce36beSmrg * @brief Deliver a SetProperty request to set WM_NAME property value.
119ecce36beSmrg * @param c The connection to the X server.
120ecce36beSmrg * @param window Window X identifier.
121ecce36beSmrg * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
122ecce36beSmrg * @param name_len Length of name value to set.
123ecce36beSmrg * @param name Name value to set.
124ecce36beSmrg */
125ecce36beSmrgvoid xcb_set_wm_name_checked(xcb_connection_t *c,
126ecce36beSmrg                             xcb_window_t window,
127ecce36beSmrg                             xcb_atom_t encoding,
128ecce36beSmrg                             uint32_t name_len,
129ecce36beSmrg                             const char *name);
130ecce36beSmrg
131ecce36beSmrg/**
132ecce36beSmrg * @see xcb_set_wm_name_checked()
133ecce36beSmrg */
134ecce36beSmrgvoid xcb_set_wm_name(xcb_connection_t *c, xcb_window_t window,
135ecce36beSmrg                     xcb_atom_t encoding, uint32_t name_len,
136ecce36beSmrg                     const char *name);
137ecce36beSmrg
138ecce36beSmrg/**
139ecce36beSmrg * @brief Deliver a GetProperty request to the X server for WM_NAME.
140ecce36beSmrg * @param c The connection to the X server.
141ecce36beSmrg * @param window Window X identifier.
142ecce36beSmrg * @return The request cookie.
143ecce36beSmrg */
144ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_name(xcb_connection_t *c,
145ecce36beSmrg                                          xcb_window_t window);
146ecce36beSmrg
147ecce36beSmrg/**
148ecce36beSmrg * @see xcb_get_wm_name()
149ecce36beSmrg */
150ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_name_unchecked(xcb_connection_t *c,
151ecce36beSmrg                                                    xcb_window_t window);
152ecce36beSmrg
153ecce36beSmrg/**
154ecce36beSmrg * @brief Fill given structure with the WM_NAME property of a window.
155ecce36beSmrg * @param c The connection to the X server.
156ecce36beSmrg * @param cookie Request cookie.
157ecce36beSmrg * @param prop WM_NAME property value.
158ecce36beSmrg * @param e Error if any.
159ecce36beSmrg * @see xcb_get_text_property_reply()
160ecce36beSmrg * @return Return 1 on success, 0 otherwise.
161ecce36beSmrg */
162ecce36beSmrguint8_t xcb_get_wm_name_reply(xcb_connection_t *c,
163ecce36beSmrg                              xcb_get_property_cookie_t cookie,
164ecce36beSmrg                              xcb_get_text_property_reply_t *prop,
165ecce36beSmrg                              xcb_generic_error_t **e);
166ecce36beSmrg
167ecce36beSmrg/**
168ecce36beSmrg * @brief Set a callback on WM_NAME property changes.
169ecce36beSmrg * @param prophs Property handlers.
170ecce36beSmrg * @param long_len Length of data.
171ecce36beSmrg * @param handler The callback.
172ecce36beSmrg * @param data data given to the callback.
173ecce36beSmrg */
174ecce36beSmrgvoid xcb_watch_wm_name(xcb_property_handlers_t *prophs, uint32_t long_len,
175ecce36beSmrg                       xcb_generic_property_handler_t handler, void *data);
176ecce36beSmrg
177ecce36beSmrg/* WM_ICON_NAME */
178ecce36beSmrg
179ecce36beSmrg/**
180ecce36beSmrg * @brief Deliver a SetProperty request to set WM_ICON_NAME property value.
181ecce36beSmrg * @param c The connection to the X server.
182ecce36beSmrg * @param window Window X identifier.
183ecce36beSmrg * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
184ecce36beSmrg * @param name_len Length of name value to set.
185ecce36beSmrg * @param name Name value to set.
186ecce36beSmrg */
187ecce36beSmrgvoid xcb_set_wm_icon_name_checked(xcb_connection_t *c, xcb_window_t window,
188ecce36beSmrg                                  xcb_atom_t encoding, uint32_t name_len,
189ecce36beSmrg                                  const char *name);
190ecce36beSmrg
191ecce36beSmrg/**
192ecce36beSmrg * @see xcb_set_wm_icon_name_checked()
193ecce36beSmrg */
194ecce36beSmrgvoid xcb_set_wm_icon_name(xcb_connection_t *c, xcb_window_t window,
195ecce36beSmrg                          xcb_atom_t encoding, uint32_t name_len,
196ecce36beSmrg                          const char *name);
197ecce36beSmrg
198ecce36beSmrg/**
199ecce36beSmrg * @brief Send request to get WM_ICON_NAME property of a window.
200ecce36beSmrg * @param c The connection to the X server.
201ecce36beSmrg * @param window Window X identifier.
202ecce36beSmrg * @return The request cookie.
203ecce36beSmrg */
204ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_icon_name(xcb_connection_t *c,
205ecce36beSmrg                                               xcb_window_t window);
206ecce36beSmrg
207ecce36beSmrg/**
208ecce36beSmrg  * @see xcb_get_wm_icon_name()
209ecce36beSmrg  */
210ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_icon_name_unchecked(xcb_connection_t *c,
211ecce36beSmrg                                                         xcb_window_t window);
212ecce36beSmrg
213ecce36beSmrg/**
214ecce36beSmrg * @brief Fill given structure with the WM_ICON_NAME property of a window.
215ecce36beSmrg * @param c The connection to the X server.
216ecce36beSmrg * @param cookie Request cookie.
217ecce36beSmrg * @param prop WM_ICON_NAME property value.
218ecce36beSmrg * @param e Error if any.
219ecce36beSmrg * @see xcb_get_text_property_reply()
220ecce36beSmrg * @return Return 1 on success, 0 otherwise.
221ecce36beSmrg */
222ecce36beSmrguint8_t xcb_get_wm_icon_name_reply(xcb_connection_t *c,
223ecce36beSmrg                                   xcb_get_property_cookie_t cookie,
224ecce36beSmrg                                   xcb_get_text_property_reply_t *prop,
225ecce36beSmrg                                   xcb_generic_error_t **e);
226ecce36beSmrg
227ecce36beSmrg/**
228ecce36beSmrg * @brief Set a callback on WM_ICON_NAME property changes.
229ecce36beSmrg * @param prophs Property handlers.
230ecce36beSmrg * @param long_len Length of data.
231ecce36beSmrg * @param handler The callback.
232ecce36beSmrg * @param data data given to the callback.
233ecce36beSmrg */
234ecce36beSmrgvoid xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len,
235ecce36beSmrg                            xcb_generic_property_handler_t handler,
236ecce36beSmrg                            void *data);
237ecce36beSmrg
238ecce36beSmrg/* WM_CLIENT_MACHINE */
239ecce36beSmrg
240ecce36beSmrg/**
241ecce36beSmrg * @brief Deliver a SetProperty request to set WM_CLIENT_MACHINE property value.
242ecce36beSmrg * @param c The connection to the X server.
243ecce36beSmrg * @param window Window X identifier.
244ecce36beSmrg * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
245ecce36beSmrg * @param name_len Length of name value to set.
246ecce36beSmrg * @param name Name value to set.
247ecce36beSmrg */
248ecce36beSmrgvoid xcb_set_wm_client_machine_checked(xcb_connection_t *c, xcb_window_t window,
249ecce36beSmrg                                       xcb_atom_t encoding, uint32_t name_len,
250ecce36beSmrg                                       const char *name);
251ecce36beSmrg
252ecce36beSmrg/**
253ecce36beSmrg * @see xcb_set_wm_client_machine_checked()
254ecce36beSmrg */
255ecce36beSmrgvoid xcb_set_wm_client_machine(xcb_connection_t *c, xcb_window_t window,
256ecce36beSmrg                               xcb_atom_t encoding, uint32_t name_len,
257ecce36beSmrg                               const char *name);
258ecce36beSmrg
259ecce36beSmrg/**
260ecce36beSmrg * @brief Send request to get WM_CLIENT_MACHINE property of a window.
261ecce36beSmrg * @param c The connection to the X server.
262ecce36beSmrg * @param window Window X identifier.
263ecce36beSmrg * @return The request cookie.
264ecce36beSmrg */
265ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_client_machine(xcb_connection_t *c,
266ecce36beSmrg                                                    xcb_window_t window);
267ecce36beSmrg
268ecce36beSmrg/**
269ecce36beSmrg * @see xcb_get_wm_client_machine()
270ecce36beSmrg */
271ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_client_machine_unchecked(xcb_connection_t *c,
272ecce36beSmrg                                                              xcb_window_t window);
273ecce36beSmrg
274ecce36beSmrg/**
275ecce36beSmrg * @brief Fill given structure with the WM_CLIENT_MACHINE property of a window.
276ecce36beSmrg * @param c The connection to the X server.
277ecce36beSmrg * @param cookie Request cookie.
278ecce36beSmrg * @param prop WM_CLIENT_MACHINE property value.
279ecce36beSmrg * @param e Error if any.
280ecce36beSmrg * @see xcb_get_text_property_reply()
281ecce36beSmrg * @return Return 1 on success, 0 otherwise.
282ecce36beSmrg */
283ecce36beSmrguint8_t xcb_get_wm_client_machine_reply(xcb_connection_t *c,
284ecce36beSmrg                                        xcb_get_property_cookie_t cookie,
285ecce36beSmrg                                        xcb_get_text_property_reply_t *prop,
286ecce36beSmrg                                        xcb_generic_error_t **e);
287ecce36beSmrg
288ecce36beSmrg/**
289ecce36beSmrg * @brief Set a callback on WM_CLIENT_MACHINE property changes.
290ecce36beSmrg * @param prophs Property handlers.
291ecce36beSmrg * @param long_len Length of data.
292ecce36beSmrg * @param handler The callback.
293ecce36beSmrg * @param data data given to the callback.
294ecce36beSmrg */
295ecce36beSmrgvoid xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs,
296ecce36beSmrg                                 uint32_t long_len,
297ecce36beSmrg                                 xcb_generic_property_handler_t handler,
298ecce36beSmrg                                 void *data);
299ecce36beSmrg
300ecce36beSmrg/* WM_CLASS */
301ecce36beSmrg
302ecce36beSmrg/**
303ecce36beSmrg * @brief WM_CLASS hint structure
304ecce36beSmrg */
305ecce36beSmrgtypedef struct {
306ecce36beSmrg  /** Instance name */
307ecce36beSmrg  char *instance_name;
308ecce36beSmrg  /** Class of application */
309ecce36beSmrg  char *class_name;
310ecce36beSmrg  /** Store reply to avoid memory allocation, should normally not be
311ecce36beSmrg      used directly */
312ecce36beSmrg  xcb_get_property_reply_t *_reply;
313ecce36beSmrg} xcb_get_wm_class_reply_t;
314ecce36beSmrg
315ecce36beSmrg/**
316ecce36beSmrg * @brief Deliver a GetProperty request to the X server for WM_CLASS.
317ecce36beSmrg * @param c The connection to the X server.
318ecce36beSmrg * @param window Window X identifier.
319ecce36beSmrg * @return The request cookie.
320ecce36beSmrg */
321ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_class(xcb_connection_t *c,
322ecce36beSmrg                                           xcb_window_t window);
323ecce36beSmrg
324ecce36beSmrg/**
325ecce36beSmrg * @see xcb_get_wm_class()
326ecce36beSmrg */
327ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_class_unchecked(xcb_connection_t *c,
328ecce36beSmrg                                                     xcb_window_t window);
329ecce36beSmrg
330ecce36beSmrg
331ecce36beSmrg/**
332ecce36beSmrg * @brief Fill give structure with the WM_CLASS property of a window.
333ecce36beSmrg * @param prop The property structur to fill.
334ecce36beSmrg * @param reply The property request reply.
335ecce36beSmrg * @return Return 1 on success, 0 otherwise.
336ecce36beSmrg */
337ecce36beSmrguint8_t
338ecce36beSmrgxcb_get_wm_class_from_reply(xcb_get_wm_class_reply_t *prop,
339ecce36beSmrg                            xcb_get_property_reply_t *reply);
340ecce36beSmrg
341ecce36beSmrg/**
342ecce36beSmrg * @brief Fill given structure with the WM_CLASS property of a window.
343ecce36beSmrg * @param c The connection to the X server.
344ecce36beSmrg * @param cookie Request cookie.
345ecce36beSmrg * @param prop WM_CLASS property value.
346ecce36beSmrg * @param e Error if any.
347ecce36beSmrg * @return Return 1 on success, 0 otherwise.
348ecce36beSmrg *
349ecce36beSmrg * The parameter e supplied to this function must be NULL if
350ecce36beSmrg * xcb_get_wm_class_unchecked() is used.  Otherwise, it stores the
351ecce36beSmrg * error if any. prop structure members should be freed by
352ecce36beSmrg * xcb_get_wm_class_reply_wipe().
353ecce36beSmrg */
354ecce36beSmrguint8_t xcb_get_wm_class_reply(xcb_connection_t *c,
355ecce36beSmrg                               xcb_get_property_cookie_t cookie,
356ecce36beSmrg                               xcb_get_wm_class_reply_t *prop,
357ecce36beSmrg                               xcb_generic_error_t **e);
358ecce36beSmrg
359ecce36beSmrg/**
360ecce36beSmrg * @brief Wipe prop structure members previously allocated by
361ecce36beSmrg *        xcb_get_wm_class_reply().
362ecce36beSmrg * @param prop prop structure whose members is going to be freed.
363ecce36beSmrg */
364ecce36beSmrgvoid xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop);
365ecce36beSmrg
366ecce36beSmrg/* WM_TRANSIENT_FOR */
367ecce36beSmrg
368ecce36beSmrg/**
369ecce36beSmrg * @brief Send request to get WM_TRANSIENT_FOR property of a window.
370ecce36beSmrg * @param c The connection to the X server
371ecce36beSmrg * @param window Window X identifier.
372ecce36beSmrg * @return The request cookie.
373ecce36beSmrg */
374ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_transient_for(xcb_connection_t *c,
375ecce36beSmrg                                                   xcb_window_t window);
376ecce36beSmrg
377ecce36beSmrg/**
378ecce36beSmrg * @see xcb_get_wm_transient_for_unchecked()
379ecce36beSmrg */
380ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_transient_for_unchecked(xcb_connection_t *c,
381ecce36beSmrg                                                             xcb_window_t window);
382ecce36beSmrg
383ecce36beSmrg/**
384ecce36beSmrg * @brief Fill given window pointer with the WM_TRANSIENT_FOR property of a window.
385ecce36beSmrg * @param prop WM_TRANSIENT_FOR property value.
386ecce36beSmrg * @param reply The get property request reply.
387ecce36beSmrg * @return Return 1 on success, 0 otherwise.
388ecce36beSmrg */
389ecce36beSmrguint8_t
390ecce36beSmrgxcb_get_wm_transient_for_from_reply(xcb_window_t *prop,
391ecce36beSmrg                                    xcb_get_property_reply_t *reply);
392ecce36beSmrg/**
393ecce36beSmrg * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window.
394ecce36beSmrg * @param c The connection to the X server.
395ecce36beSmrg * @param cookie Request cookie.
396ecce36beSmrg * @param prop WM_TRANSIENT_FOR property value.
397ecce36beSmrg * @param e Error if any.
398ecce36beSmrg * @return Return 1 on success, 0 otherwise.
399ecce36beSmrg *
400ecce36beSmrg * The parameter e supplied to this function must be NULL if
401ecce36beSmrg * xcb_get_wm_transient_for_unchecked() is used.  Otherwise, it stores
402ecce36beSmrg * the error if any.
403ecce36beSmrg */
404ecce36beSmrguint8_t xcb_get_wm_transient_for_reply(xcb_connection_t *c,
405ecce36beSmrg                                       xcb_get_property_cookie_t cookie,
406ecce36beSmrg                                       xcb_window_t *prop,
407ecce36beSmrg                                       xcb_generic_error_t **e);
408ecce36beSmrg
409ecce36beSmrg/* WM_SIZE_HINTS */
410ecce36beSmrg
411ecce36beSmrgtypedef enum {
412ecce36beSmrg  XCB_SIZE_HINT_US_POSITION = 1 << 0,
413ecce36beSmrg  XCB_SIZE_HINT_US_SIZE = 1 << 1,
414ecce36beSmrg  XCB_SIZE_HINT_P_POSITION = 1 << 2,
415ecce36beSmrg  XCB_SIZE_HINT_P_SIZE = 1 << 3,
416ecce36beSmrg  XCB_SIZE_HINT_P_MIN_SIZE = 1 << 4,
417ecce36beSmrg  XCB_SIZE_HINT_P_MAX_SIZE = 1 << 5,
418ecce36beSmrg  XCB_SIZE_HINT_P_RESIZE_INC = 1 << 6,
419ecce36beSmrg  XCB_SIZE_HINT_P_ASPECT = 1 << 7,
420ecce36beSmrg  XCB_SIZE_HINT_BASE_SIZE = 1 << 8,
421ecce36beSmrg  XCB_SIZE_HINT_P_WIN_GRAVITY = 1 << 9
422ecce36beSmrg} xcb_size_hints_flags_t;
423ecce36beSmrg
424ecce36beSmrg/**
425ecce36beSmrg * @brief Size hints structure.
426ecce36beSmrg */
427ecce36beSmrgtypedef struct {
428ecce36beSmrg  /** User specified flags */
429ecce36beSmrg  uint32_t flags;
430ecce36beSmrg  /** User-specified position */
431ecce36beSmrg  int32_t x, y;
432ecce36beSmrg  /** User-specified size */
433ecce36beSmrg  int32_t width, height;
434ecce36beSmrg  /** Program-specified minimum size */
435ecce36beSmrg  int32_t min_width, min_height;
436ecce36beSmrg  /** Program-specified maximum size */
437ecce36beSmrg  int32_t max_width, max_height;
438ecce36beSmrg  /** Program-specified resize increments */
439ecce36beSmrg  int32_t width_inc, height_inc;
440ecce36beSmrg  /** Program-specified minimum aspect ratios */
441ecce36beSmrg  int32_t min_aspect_num, min_aspect_den;
442ecce36beSmrg  /** Program-specified maximum aspect ratios */
443ecce36beSmrg  int32_t max_aspect_num, max_aspect_den;
444ecce36beSmrg  /** Program-specified base size */
445ecce36beSmrg  int32_t base_width, base_height;
446ecce36beSmrg  /** Program-specified window gravity */
447ecce36beSmrg  uint32_t win_gravity;
448ecce36beSmrg} xcb_size_hints_t;
449ecce36beSmrg
450ecce36beSmrg/**
451ecce36beSmrg * @brief Set size hints to a given position.
452ecce36beSmrg * @param hints SIZE_HINTS structure.
453ecce36beSmrg * @param user_specified Is the size user-specified?
454ecce36beSmrg * @param x The X position.
455ecce36beSmrg * @param y The Y position.
456ecce36beSmrg */
457ecce36beSmrgvoid xcb_size_hints_set_position(xcb_size_hints_t *hints, int user_specified,
458ecce36beSmrg                                 int32_t x, int32_t y);
459ecce36beSmrg
460ecce36beSmrg/**
461ecce36beSmrg * @brief Set size hints to a given size.
462ecce36beSmrg * @param hints SIZE_HINTS structure.
463ecce36beSmrg * @param user_specified is the size user-specified?
464ecce36beSmrg * @param width The width.
465ecce36beSmrg * @param height The height.
466ecce36beSmrg */
467ecce36beSmrgvoid xcb_size_hints_set_size(xcb_size_hints_t *hints, int user_specified,
468ecce36beSmrg                             int32_t width, int32_t height);
469ecce36beSmrg
470ecce36beSmrg/**
471ecce36beSmrg * @brief Set size hints to a given minimum size.
472ecce36beSmrg * @param hints SIZE_HINTS structure.
473ecce36beSmrg * @param width The minimum width.
474ecce36beSmrg * @param height The minimum height.
475ecce36beSmrg */
476ecce36beSmrgvoid xcb_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width,
477ecce36beSmrg                                 int32_t min_height);
478ecce36beSmrg
479ecce36beSmrg/**
480ecce36beSmrg * @brief Set size hints to a given maximum size.
481ecce36beSmrg * @param hints SIZE_HINTS structure.
482ecce36beSmrg * @param width The maximum width.
483ecce36beSmrg * @param height The maximum height.
484ecce36beSmrg */
485ecce36beSmrgvoid xcb_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width,
486ecce36beSmrg                                 int32_t max_height);
487ecce36beSmrg
488ecce36beSmrg/**
489ecce36beSmrg * @brief Set size hints to a given resize increments.
490ecce36beSmrg * @param hints SIZE_HINTS structure.
491ecce36beSmrg * @param width The resize increments width.
492ecce36beSmrg * @param height The resize increments height.
493ecce36beSmrg */
494ecce36beSmrgvoid xcb_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc,
495ecce36beSmrg                                   int32_t height_inc);
496ecce36beSmrg
497ecce36beSmrg/**
498ecce36beSmrg * @brief Set size hints to a given aspect ratios.
499ecce36beSmrg * @param hints SIZE_HINTS structure.
500ecce36beSmrg * @param min_aspect_num The minimum aspect ratios for the width.
501ecce36beSmrg * @param min_aspect_den The minimum aspect ratios for the height.
502ecce36beSmrg * @param max_aspect_num The maximum aspect ratios for the width.
503ecce36beSmrg * @param max_aspect_den The maximum aspect ratios for the height.
504ecce36beSmrg */
505ecce36beSmrgvoid xcb_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num,
506ecce36beSmrg                               int32_t min_aspect_den, int32_t max_aspect_num,
507ecce36beSmrg                               int32_t max_aspect_den);
508ecce36beSmrg
509ecce36beSmrg/**
510ecce36beSmrg * @brief Set size hints to a given base size.
511ecce36beSmrg * @param hints SIZE_HINTS structure.
512ecce36beSmrg * @param base_width Base width.
513ecce36beSmrg * @param base_height Base height.
514ecce36beSmrg */
515ecce36beSmrgvoid xcb_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width,
516ecce36beSmrg                                  int32_t base_height);
517ecce36beSmrg
518ecce36beSmrg/**
519ecce36beSmrg * @brief Set size hints to a given window gravity.
520ecce36beSmrg * @param hints SIZE_HINTS structure.
521ecce36beSmrg * @param win_gravity Window gravity value.
522ecce36beSmrg */
523ecce36beSmrgvoid xcb_size_hints_set_win_gravity(xcb_size_hints_t *hints,
52460ecc4c7Splunky                                    xcb_gravity_t win_gravity);
525ecce36beSmrg
526ecce36beSmrg/**
527ecce36beSmrg * @brief Deliver a ChangeProperty request to set a value to a given property.
528ecce36beSmrg * @param c The connection to the X server.
529ecce36beSmrg * @param window Window X identifier.
530ecce36beSmrg * @param property Property to set value for.
531ecce36beSmrg * @param hints Hints value to set.
532ecce36beSmrg */
533ecce36beSmrgvoid xcb_set_wm_size_hints_checked(xcb_connection_t *c, xcb_window_t window,
534ecce36beSmrg                                   xcb_atom_t property, xcb_size_hints_t *hints);
535ecce36beSmrg
536ecce36beSmrg/**
537ecce36beSmrg * @see xcb_set_wm_size_hints_checked()
538ecce36beSmrg */
539ecce36beSmrgvoid xcb_set_wm_size_hints(xcb_connection_t *c, xcb_window_t window,
540ecce36beSmrg                           xcb_atom_t property, xcb_size_hints_t *hints);
541ecce36beSmrg
542ecce36beSmrg/**
543ecce36beSmrg * @brief Send request to get size hints structure for the named property.
544ecce36beSmrg * @param c The connection to the X server.
545ecce36beSmrg * @param window Window X identifier.
546ecce36beSmrg * @param property Specify the property name.
547ecce36beSmrg * @return The request cookie.
548ecce36beSmrg */
549ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_size_hints(xcb_connection_t *c,
550ecce36beSmrg                                                xcb_window_t window,
551ecce36beSmrg                                                xcb_atom_t property);
552ecce36beSmrg
553ecce36beSmrg/**
554ecce36beSmrg * @see xcb_get_wm_size_hints()
555ecce36beSmrg */
556ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_size_hints_unchecked(xcb_connection_t *c,
557ecce36beSmrg                                                          xcb_window_t window,
558ecce36beSmrg                                                          xcb_atom_t property);
559ecce36beSmrg
560ecce36beSmrg/**
561ecce36beSmrg * @brief Fill given structure with the size hints of the named property.
562ecce36beSmrg * @param c The connection to the X server.
563ecce36beSmrg * @param cookie Request cookie.
564ecce36beSmrg * @param hints Size hints structure.
565ecce36beSmrg * @param e Error if any.
566ecce36beSmrg * @return Return 1 on success, 0 otherwise.
567ecce36beSmrg *
568ecce36beSmrg * The parameter e supplied to this function must be NULL if
569ecce36beSmrg * xcb_get_wm_size_hints_unchecked() is used.  Otherwise, it stores
570ecce36beSmrg * the error if any. The returned pointer should be freed.
571ecce36beSmrg */
572ecce36beSmrguint8_t xcb_get_wm_size_hints_reply(xcb_connection_t *c,
573ecce36beSmrg                                    xcb_get_property_cookie_t cookie,
574ecce36beSmrg                                    xcb_size_hints_t *hints,
575ecce36beSmrg                                    xcb_generic_error_t **e);
576ecce36beSmrg
577ecce36beSmrg/* WM_NORMAL_HINTS */
578ecce36beSmrg
579ecce36beSmrg/**
580ecce36beSmrg * @brief Deliver a ChangeProperty request to set WM_NORMAL_HINTS property value.
581ecce36beSmrg * @param c The connection to the X server.
582ecce36beSmrg * @param window Window X identifier.
583ecce36beSmrg * @param hints Hints value to set.
584ecce36beSmrg */
585ecce36beSmrgvoid xcb_set_wm_normal_hints_checked(xcb_connection_t *c, xcb_window_t window,
586ecce36beSmrg                                     xcb_size_hints_t *hints);
587ecce36beSmrg
588ecce36beSmrg/**
589ecce36beSmrg * @see xcb_set_wm_normal_hints_checked()
590ecce36beSmrg */
591ecce36beSmrgvoid xcb_set_wm_normal_hints(xcb_connection_t *c, xcb_window_t window,
592ecce36beSmrg                             xcb_size_hints_t *hints);
593ecce36beSmrg
594ecce36beSmrg/**
595ecce36beSmrg * @brief Send request to get WM_NORMAL_HINTS property of a window.
596ecce36beSmrg * @param c The connection to the X server.
597ecce36beSmrg * @param window Window X identifier.
598ecce36beSmrg * @return The request cookie.
599ecce36beSmrg */
600ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_normal_hints(xcb_connection_t *c,
601ecce36beSmrg                                                  xcb_window_t window);
602ecce36beSmrg
603ecce36beSmrg/**
604ecce36beSmrg * @see xcb_get_wm_normal_hints()
605ecce36beSmrg */
606ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_normal_hints_unchecked(xcb_connection_t *c,
607ecce36beSmrg                                                            xcb_window_t window);
608ecce36beSmrg
609ecce36beSmrg/**
610ecce36beSmrg * @brief Fill given structure with the WM_NORMAL_HINTS property of a window.
611ecce36beSmrg * @param hints WM_NORMAL_HINTS property value.
612ecce36beSmrg * @param reply The get property request reply.
613ecce36beSmrg * @return Return 1 on success, 0 otherwise.
614ecce36beSmrg */
615ecce36beSmrguint8_t
616ecce36beSmrgxcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints,
617ecce36beSmrg                                 xcb_get_property_reply_t *reply);
618ecce36beSmrg
619ecce36beSmrg/**
620ecce36beSmrg * @brief Fill given structure with the WM_NORMAL_HINTS property of a window.
621ecce36beSmrg * @param c The connection to the X server.
622ecce36beSmrg * @param cookie Request cookie.
623ecce36beSmrg * @param hints WM_NORMAL_HINTS property value.
624ecce36beSmrg * @param e Error if any.
625ecce36beSmrg * @return Return 1 on success, 0 otherwise.
626ecce36beSmrg *
627ecce36beSmrg * The parameter e supplied to this function must be NULL if
628ecce36beSmrg * xcb_get_wm_normal_hints_unchecked() is used.  Otherwise, it stores
629ecce36beSmrg * the error if any. The returned pointer should be freed.
630ecce36beSmrg */
631ecce36beSmrguint8_t xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
632ecce36beSmrg                                      xcb_get_property_cookie_t cookie,
633ecce36beSmrg                                      xcb_size_hints_t *hints,
634ecce36beSmrg                                      xcb_generic_error_t **e);
635ecce36beSmrg
636ecce36beSmrg/* WM_HINTS */
637ecce36beSmrg
638ecce36beSmrg/**
639ecce36beSmrg * @brief WM hints structure (may be extended in the future).
640ecce36beSmrg */
641ecce36beSmrgtypedef struct {
642ecce36beSmrg  /** Marks which fields in this structure are defined */
643ecce36beSmrg  int32_t flags;
644ecce36beSmrg  /** Does this application rely on the window manager to get keyboard
645ecce36beSmrg      input? */
646ecce36beSmrg  uint32_t input;
647ecce36beSmrg  /** See below */
648ecce36beSmrg  int32_t initial_state;
649ecce36beSmrg  /** Pixmap to be used as icon */
650ecce36beSmrg  xcb_pixmap_t icon_pixmap;
651ecce36beSmrg  /** Window to be used as icon */
652ecce36beSmrg  xcb_window_t icon_window;
653ecce36beSmrg  /** Initial position of icon */
654ecce36beSmrg  int32_t icon_x, icon_y;
655ecce36beSmrg  /** Icon mask bitmap */
656ecce36beSmrg  xcb_pixmap_t icon_mask;
657ecce36beSmrg  /* Identifier of related window group */
658ecce36beSmrg  xcb_window_t window_group;
659ecce36beSmrg} xcb_wm_hints_t;
660ecce36beSmrg
661ecce36beSmrg/** Number of elements in this structure */
662ecce36beSmrg#define XCB_NUM_WM_HINTS_ELEMENTS 9
663ecce36beSmrg
664ecce36beSmrg/**
665ecce36beSmrg * @brief WM_HINTS window states.
666ecce36beSmrg */
667ecce36beSmrgtypedef enum {
668ecce36beSmrg  XCB_WM_STATE_WITHDRAWN = 0,
669ecce36beSmrg  XCB_WM_STATE_NORMAL = 1,
670ecce36beSmrg  XCB_WM_STATE_ICONIC = 3
671ecce36beSmrg} xcb_wm_state_t;
672ecce36beSmrg
673ecce36beSmrgtypedef enum {
674ecce36beSmrg  XCB_WM_HINT_INPUT = (1L << 0),
675ecce36beSmrg  XCB_WM_HINT_STATE = (1L << 1),
676ecce36beSmrg  XCB_WM_HINT_ICON_PIXMAP = (1L << 2),
677ecce36beSmrg  XCB_WM_HINT_ICON_WINDOW = (1L << 3),
678ecce36beSmrg  XCB_WM_HINT_ICON_POSITION = (1L << 4),
679ecce36beSmrg  XCB_WM_HINT_ICON_MASK = (1L << 5),
680ecce36beSmrg  XCB_WM_HINT_WINDOW_GROUP = (1L << 6),
681ecce36beSmrg  XCB_WM_HINT_X_URGENCY = (1L << 8)
682ecce36beSmrg} xcb_wm_t;
683ecce36beSmrg
684ecce36beSmrg#define XCB_WM_ALL_HINTS (XCB_WM_HINT_INPUT | XCB_WM_HINT_STATE |\
685ecce36beSmrg                          XCB_WM_HINT_ICON_PIXMAP | XCB_WM_HINT_ICON_WINDOW |\
686ecce36beSmrg                          XCB_WM_HINT_ICON_POSITION | XCB_WM_HINT_ICON_MASK |\
687ecce36beSmrg                          XCB_WM_HINT_WINDOW_GROUP)
688ecce36beSmrg
689ecce36beSmrg/**
690ecce36beSmrg * @brief Get urgency hint.
691ecce36beSmrg * @param hints WM_HINTS structure.
692ecce36beSmrg * @return Urgency hint value.
693ecce36beSmrg */
694ecce36beSmrguint32_t xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints);
695ecce36beSmrg
696ecce36beSmrg/**
697ecce36beSmrg * @brief Set input focus.
698ecce36beSmrg * @param hints WM_HINTS structure.
699ecce36beSmrg * @param input Input focus.
700ecce36beSmrg */
701ecce36beSmrgvoid xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input);
702ecce36beSmrg
703ecce36beSmrg/**
704ecce36beSmrg * @brief Set hints state to 'iconic'.
705ecce36beSmrg * @param hints WM_HINTS structure.
706ecce36beSmrg */
707ecce36beSmrgvoid xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints);
708ecce36beSmrg
709ecce36beSmrg/**
710ecce36beSmrg * @brief Set hints state to 'normal'.
711ecce36beSmrg * @param hints WM_HINTS structure.
712ecce36beSmrg */
713ecce36beSmrgvoid xcb_wm_hints_set_normal(xcb_wm_hints_t *hints);
714ecce36beSmrg
715ecce36beSmrg/**
716ecce36beSmrg * @brief Set hints state to 'withdrawn'.
717ecce36beSmrg * @param hints WM_HINTS structure.
718ecce36beSmrg */
719ecce36beSmrgvoid xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints);
720ecce36beSmrg
721ecce36beSmrg/**
722ecce36beSmrg * @brief Set hints state to none.
723ecce36beSmrg * @param hints WM_HINTS structure.
724ecce36beSmrg */
725ecce36beSmrgvoid xcb_wm_hints_set_none(xcb_wm_hints_t *hints);
726ecce36beSmrg
727ecce36beSmrg/**
728ecce36beSmrg * @brief Set pixmap to be used as icon.
729ecce36beSmrg * @param hints WM_HINTS structure.
730ecce36beSmrg * @param icon_pixmap Pixmap.
731ecce36beSmrg */
732ecce36beSmrgvoid xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints,
733ecce36beSmrg                                  xcb_pixmap_t icon_pixmap);
734ecce36beSmrg
735ecce36beSmrg/**
736ecce36beSmrg * @brief Set icon mask bitmap.
737ecce36beSmrg * @param hints WM_HINTS structure.
738ecce36beSmrg * @param icon_mask Pixmap.
739ecce36beSmrg */
740ecce36beSmrgvoid xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask);
741ecce36beSmrg
742ecce36beSmrg/**
743ecce36beSmrg * @brief Set window identifier to be used as icon.
744ecce36beSmrg * @param hints WM_HINTS structure.
745ecce36beSmrg * @param icon_window Window X identifier.
746ecce36beSmrg */
747ecce36beSmrgvoid xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints,
748ecce36beSmrg                                  xcb_window_t icon_window);
749ecce36beSmrg
750ecce36beSmrg/**
751ecce36beSmrg * @brief Set identifier of related window group.
752ecce36beSmrg * @param hints WM_HINTS structure.
753ecce36beSmrg * @param window_group Window X identifier.
754ecce36beSmrg */
755ecce36beSmrgvoid xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints,
756ecce36beSmrg                                   xcb_window_t window_group);
757ecce36beSmrg
758ecce36beSmrg/**
759ecce36beSmrg * @brief Set urgency hints flag.
760ecce36beSmrg * @param hints WM_HINTS structure.
761ecce36beSmrg */
762ecce36beSmrgvoid xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints);
763ecce36beSmrg
764ecce36beSmrg/**
765ecce36beSmrg * @brief Deliver a SetProperty request to set WM_HINTS property value.
766ecce36beSmrg * @param c The connection to the X server.
767ecce36beSmrg * @param window Window X identifier.
768ecce36beSmrg * @param hints Hints value to set.
769ecce36beSmrg */
770ecce36beSmrgvoid xcb_set_wm_hints_checked(xcb_connection_t *c, xcb_window_t window,
771ecce36beSmrg                              xcb_wm_hints_t *hints);
772ecce36beSmrg
773ecce36beSmrg/**
774ecce36beSmrg * @see xcb_set_wm_hints_checked()
775ecce36beSmrg */
776ecce36beSmrgvoid xcb_set_wm_hints(xcb_connection_t *c, xcb_window_t window,
777ecce36beSmrg                      xcb_wm_hints_t *hints);
778ecce36beSmrg
779ecce36beSmrg/**
780ecce36beSmrg * @brief Send request to get WM_HINTS property of a window.
781ecce36beSmrg * @param c The connection to the X server.
782ecce36beSmrg * @param window Window X identifier.
783ecce36beSmrg * @return The request cookie.
784ecce36beSmrg */
785ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_hints(xcb_connection_t *c,
786ecce36beSmrg                                           xcb_window_t window);
787ecce36beSmrg
788ecce36beSmrg/**
789ecce36beSmrg * @see xcb_get_wm_hints()
790ecce36beSmrg */
791ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_hints_unchecked(xcb_connection_t *c,
792ecce36beSmrg                                                     xcb_window_t window);
793ecce36beSmrg
794ecce36beSmrg/**
795ecce36beSmrg * @brief Fill given structure with the WM_HINTS property of a window.
796ecce36beSmrg * @param hints WM_HINTS property value.
797ecce36beSmrg * @param reply The get property request reply.
798ecce36beSmrg * @return Return 1 on success, 0 otherwise.
799ecce36beSmrg */
800ecce36beSmrguint8_t
801ecce36beSmrgxcb_get_wm_hints_from_reply(xcb_wm_hints_t *hints,
802ecce36beSmrg                            xcb_get_property_reply_t *reply);
803ecce36beSmrg
804ecce36beSmrg/**
805ecce36beSmrg * @brief Fill given structure with the WM_HINTS property of a window.
806ecce36beSmrg * @param c The connection to the X server.
807ecce36beSmrg * @param cookie Request cookie.
808ecce36beSmrg * @param hints WM_HINTS property value.
809ecce36beSmrg * @param e Error if any.
810ecce36beSmrg * @return Return 1 on success, 0 otherwise.
811ecce36beSmrg *
812ecce36beSmrg * The parameter e supplied to this function must be NULL if
813ecce36beSmrg * xcb_get_wm_hints_unchecked() is used.  Otherwise, it stores the
814ecce36beSmrg * error if any. The returned pointer should be freed.
815ecce36beSmrg */
816ecce36beSmrguint8_t xcb_get_wm_hints_reply(xcb_connection_t *c,
817ecce36beSmrg                               xcb_get_property_cookie_t cookie,
818ecce36beSmrg                               xcb_wm_hints_t *hints,
819ecce36beSmrg                               xcb_generic_error_t **e);
820ecce36beSmrg
821ecce36beSmrg/* WM_PROTOCOLS */
822ecce36beSmrg
823ecce36beSmrg/**
824ecce36beSmrg * @brief Deliver a SetProperty request to set WM_PROTOCOLS property value.
825ecce36beSmrg * @param c The connection to the X server.
826ecce36beSmrg * @param wm_protocols The WM_PROTOCOLS atom.
827ecce36beSmrg * @param window Window X identifier.
828ecce36beSmrg * @param list_len Atom list len.
829ecce36beSmrg * @param list Atom list.
830ecce36beSmrg */
831ecce36beSmrgvoid xcb_set_wm_protocols_checked(xcb_connection_t *c, xcb_atom_t wm_protocols,
832ecce36beSmrg                                  xcb_window_t window, uint32_t list_len,
833ecce36beSmrg                                  xcb_atom_t *list);
834ecce36beSmrg
835ecce36beSmrg/**
836ecce36beSmrg * @see xcb_set_wm_protocols_checked()
837ecce36beSmrg */
838ecce36beSmrgvoid xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols,
839ecce36beSmrg                          xcb_window_t window, uint32_t list_len,
840ecce36beSmrg                          xcb_atom_t *list);
841ecce36beSmrg
842ecce36beSmrg/**
843ecce36beSmrg * @brief WM_PROTOCOLS structure.
844ecce36beSmrg */
845ecce36beSmrgtypedef struct {
846ecce36beSmrg  /** Length of the atoms list */
847ecce36beSmrg  uint32_t atoms_len;
848ecce36beSmrg  /** Atoms list */
849ecce36beSmrg  xcb_atom_t *atoms;
850ecce36beSmrg  /** Store reply to avoid memory allocation, should normally not be
851ecce36beSmrg      used directly */
852ecce36beSmrg  xcb_get_property_reply_t *_reply;
853ecce36beSmrg} xcb_get_wm_protocols_reply_t;
854ecce36beSmrg
855ecce36beSmrg/**
856ecce36beSmrg * @brief Send request to get WM_PROTOCOLS property of a given window.
857ecce36beSmrg * @param c The connection to the X server.
858ecce36beSmrg * @param window Window X identifier.
859ecce36beSmrg * @return The request cookie.
860ecce36beSmrg */
861ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_protocols(xcb_connection_t *c,
862ecce36beSmrg                                               xcb_window_t window,
863ecce36beSmrg                                               xcb_atom_t wm_protocol_atom);
864ecce36beSmrg
865ecce36beSmrg/**
866ecce36beSmrg * @see xcb_get_wm_protocols()
867ecce36beSmrg */
868ecce36beSmrgxcb_get_property_cookie_t xcb_get_wm_protocols_unchecked(xcb_connection_t *c,
869ecce36beSmrg                                                         xcb_window_t window,
870ecce36beSmrg                                                         xcb_atom_t wm_protocol_atom);
871ecce36beSmrg
872ecce36beSmrg/**
873ecce36beSmrg * @brief Fill the given structure with the WM_PROTOCOLS property of a window.
874ecce36beSmrg * @param reply The reply of the GetProperty request.
875ecce36beSmrg * @param protocols WM_PROTOCOLS property value.
876ecce36beSmrg * @return Return 1 on success, 0 otherwise.
877ecce36beSmrg *
878ecce36beSmrg * protocols structure members should be freed by
879ecce36beSmrg * xcb_get_wm_protocols_reply_wipe().
880ecce36beSmrg */
881ecce36beSmrguint8_t xcb_get_wm_protocols_from_reply(xcb_get_property_reply_t *reply,
882ecce36beSmrg                                        xcb_get_wm_protocols_reply_t *protocols);
883ecce36beSmrg/**
884ecce36beSmrg * @brief Fill the given structure with the WM_PROTOCOLS property of a window.
885ecce36beSmrg * @param c The connection to the X server.
886ecce36beSmrg * @param cookie Request cookie.
887ecce36beSmrg * @param protocols WM_PROTOCOLS property value.
888ecce36beSmrg * @param e Error if any.
889ecce36beSmrg * @return Return 1 on success, 0 otherwise.
890ecce36beSmrg *
891ecce36beSmrg * The parameter e supplied to this function must be NULL if
892ecce36beSmrg * xcb_get_wm_protocols_unchecked() is used.  Otherwise, it stores the
893ecce36beSmrg * error if any. protocols structure members should be freed by
894ecce36beSmrg * xcb_get_wm_protocols_reply_wipe().
895ecce36beSmrg */
896ecce36beSmrguint8_t xcb_get_wm_protocols_reply(xcb_connection_t *c,
897ecce36beSmrg                                   xcb_get_property_cookie_t cookie,
898ecce36beSmrg                                   xcb_get_wm_protocols_reply_t *protocols,
899ecce36beSmrg                                   xcb_generic_error_t **e);
900ecce36beSmrg
901ecce36beSmrg/**
902ecce36beSmrg * @brief Wipe protocols structure members previously allocated by
903ecce36beSmrg *        xcb_get_wm_protocols_reply().
904ecce36beSmrg * @param protocols protocols structure whose members is going to be freed.
905ecce36beSmrg */
906ecce36beSmrgvoid xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols);
907ecce36beSmrg
908ecce36beSmrg#ifdef __cplusplus
909ecce36beSmrg}
910ecce36beSmrg#endif
911ecce36beSmrg
912ecce36beSmrg/**
913ecce36beSmrg * @}
914ecce36beSmrg */
915ecce36beSmrg
916ecce36beSmrg#endif /* __XCB_ICCCM_H__ */
917