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