Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:42

0001 #ifndef __XCB_ICCCM_H__
0002 #define __XCB_ICCCM_H__
0003 
0004 /*
0005  * Copyright (C) 2008 Arnaud Fontaine <arnau@debian.org>
0006  * Copyright (C) 2007-2008 Vincent Torri <vtorri@univ-evry.fr>
0007  *
0008  * Permission is hereby granted, free of charge, to any person
0009  * obtaining a copy of this software and associated documentation
0010  * files (the "Software"), to deal in the Software without
0011  * restriction, including without limitation the rights to use, copy,
0012  * modify, merge, publish, distribute, sublicense, and/or sell copies
0013  * of the Software, and to permit persons to whom the Software is
0014  * furnished to do so, subject to the following conditions:
0015  *
0016  * The above copyright notice and this permission notice shall be
0017  * included in all copies or substantial portions of the Software.
0018  *
0019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0020  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0021  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0022  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
0023  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
0024  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0025  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0026  *
0027  * Except as contained in this notice, the names of the authors or
0028  * their institutions shall not be used in advertising or otherwise to
0029  * promote the sale, use or other dealings in this Software without
0030  * prior written authorization from the authors.
0031  */
0032 
0033 /**
0034  * @defgroup xcb__icccm_t XCB ICCCM Functions
0035  *
0036  * These functions allow easy handling of the protocol described in the
0037  * Inter-Client Communication Conventions Manual.
0038  *
0039  * @{
0040  */
0041 
0042 #include <xcb/xcb.h>
0043 
0044 #ifdef __cplusplus
0045 extern "C" {
0046 #endif
0047 
0048 /**
0049  * @brief TextProperty reply structure.
0050  */
0051 typedef struct {
0052 /** Store reply to avoid memory allocation, should normally not be
0053     used directly */
0054 xcb_get_property_reply_t *_reply;
0055 /** Encoding used */
0056 xcb_atom_t encoding;
0057 /** Length of the name field above */
0058 uint32_t name_len;
0059 /** Property value */
0060 char *name;
0061 /** Format, may be 8, 16 or 32 */
0062 uint8_t format;
0063 } xcb_icccm_get_text_property_reply_t;
0064 
0065 /**
0066  * @brief Deliver a GetProperty request to the X server.
0067  * @param c The connection to the X server.
0068  * @param window Window X identifier.
0069  * @param property Property atom to get.
0070  * @return The request cookie.
0071  *
0072  * Allow to get a window property, in most case you might want to use
0073  * above functions to get an ICCCM property for a given window.
0074  */
0075 xcb_get_property_cookie_t xcb_icccm_get_text_property(xcb_connection_t *c,
0076                                                         xcb_window_t window,
0077                                                         xcb_atom_t property);
0078 
0079 /**
0080  * @see xcb_icccm_get_text_property()
0081  */
0082 xcb_get_property_cookie_t xcb_icccm_get_text_property_unchecked(xcb_connection_t *c,
0083                                                                   xcb_window_t window,
0084                                                                   xcb_atom_t property);
0085 
0086 /**
0087  * @brief Fill given structure with the property value of a window.
0088  * @param c The connection to the X server.
0089  * @param cookie TextProperty request cookie.
0090  * @param prop TextProperty reply which is to be filled.
0091  * @param e Error if any.
0092  * @return Return 1 on success, 0 otherwise.
0093  *
0094  * If the function return 0 (failure), the content of prop is unmodified and
0095  * therefore the structure must not be wiped.
0096  *
0097  * The parameter e supplied to this function must be NULL if
0098  * xcb_icccm_get_text_property_unchecked() is used.  Otherwise, it stores
0099  * the error if any.  prop structure members should be freed by
0100  * xcb_icccm_get_text_property_reply_wipe().
0101  */
0102 uint8_t xcb_icccm_get_text_property_reply(xcb_connection_t *c,
0103                                             xcb_get_property_cookie_t cookie,
0104                                             xcb_icccm_get_text_property_reply_t *prop,
0105                                             xcb_generic_error_t **e);
0106 
0107 /**
0108  * @brief Wipe prop structure members previously allocated by
0109  *        xcb_icccm_get_text_property_reply().
0110  * @param prop prop structure whose members is going to be freed.
0111  */
0112 void xcb_icccm_get_text_property_reply_wipe(xcb_icccm_get_text_property_reply_t *prop);
0113 
0114 /* WM_NAME */
0115 
0116 /**
0117  * @brief Deliver a SetProperty request to set WM_NAME property value.
0118  * @param c The connection to the X server.
0119  * @param window Window X identifier.
0120  * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
0121  * @param format Encoding format.
0122  * @param name_len Length of name value to set.
0123  * @param name Name value to set.
0124  */
0125 xcb_void_cookie_t xcb_icccm_set_wm_name_checked(xcb_connection_t *c,
0126                                                   xcb_window_t window,
0127                                                   xcb_atom_t encoding,
0128                                                   uint8_t format,
0129                                                   uint32_t name_len,
0130                                                   const char *name);
0131 
0132 /**
0133  * @see xcb_icccm_set_wm_name_checked()
0134  */
0135 xcb_void_cookie_t xcb_icccm_set_wm_name(xcb_connection_t *c, xcb_window_t window,
0136                                           xcb_atom_t encoding, uint8_t format,
0137                                           uint32_t name_len, const char *name);
0138 
0139 /**
0140  * @brief Deliver a GetProperty request to the X server for WM_NAME.
0141  * @param c The connection to the X server.
0142  * @param window Window X identifier.
0143  * @return The request cookie.
0144  */
0145 xcb_get_property_cookie_t xcb_icccm_get_wm_name(xcb_connection_t *c,
0146                                                   xcb_window_t window);
0147 
0148 /**
0149  * @see xcb_icccm_get_wm_name()
0150  */
0151 xcb_get_property_cookie_t xcb_icccm_get_wm_name_unchecked(xcb_connection_t *c,
0152                                                             xcb_window_t window);
0153 
0154 /**
0155  * @brief Fill given structure with the WM_NAME property of a window.
0156  * @param c The connection to the X server.
0157  * @param cookie Request cookie.
0158  * @param prop WM_NAME property value.
0159  * @param e Error if any.
0160  * @see xcb_icccm_get_text_property_reply()
0161  * @return Return 1 on success, 0 otherwise.
0162  */
0163 uint8_t xcb_icccm_get_wm_name_reply(xcb_connection_t *c,
0164                                       xcb_get_property_cookie_t cookie,
0165                                       xcb_icccm_get_text_property_reply_t *prop,
0166                                       xcb_generic_error_t **e);
0167 
0168 /* WM_ICON_NAME */
0169 
0170 /**
0171  * @brief Deliver a SetProperty request to set WM_ICON_NAME property value.
0172  * @param c The connection to the X server.
0173  * @param window Window X identifier.
0174  * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
0175  * @param format Encoding format.
0176  * @param name_len Length of name value to set.
0177  * @param name Name value to set.
0178  */
0179 xcb_void_cookie_t xcb_icccm_set_wm_icon_name_checked(xcb_connection_t *c,
0180                                                        xcb_window_t window,
0181                                                        xcb_atom_t encoding,
0182                                                        uint8_t format,
0183                                                        uint32_t name_len,
0184                                                        const char *name);
0185 
0186 /**
0187  * @see xcb_icccm_set_wm_icon_name_checked()
0188  */
0189 xcb_void_cookie_t xcb_icccm_set_wm_icon_name(xcb_connection_t *c,
0190                                                xcb_window_t window,
0191                                                xcb_atom_t encoding,
0192                                                uint8_t format,
0193                                                uint32_t name_len,
0194                                                const char *name);
0195 
0196 /**
0197  * @brief Send request to get WM_ICON_NAME property of a window.
0198  * @param c The connection to the X server.
0199  * @param window Window X identifier.
0200  * @return The request cookie.
0201  */
0202 xcb_get_property_cookie_t xcb_icccm_get_wm_icon_name(xcb_connection_t *c,
0203                                                        xcb_window_t window);
0204 
0205 /**
0206  * @see xcb_icccm_get_wm_icon_name()
0207  */
0208 xcb_get_property_cookie_t xcb_icccm_get_wm_icon_name_unchecked(xcb_connection_t *c,
0209                                                                  xcb_window_t window);
0210 
0211 /**
0212  * @brief Fill given structure with the WM_ICON_NAME property of a window.
0213  * @param c The connection to the X server.
0214  * @param cookie Request cookie.
0215  * @param prop WM_ICON_NAME property value.
0216  * @param e Error if any.
0217  * @see xcb_icccm_get_text_property_reply()
0218  * @return Return 1 on success, 0 otherwise.
0219  */
0220 uint8_t xcb_icccm_get_wm_icon_name_reply(xcb_connection_t *c,
0221                                            xcb_get_property_cookie_t cookie,
0222                                            xcb_icccm_get_text_property_reply_t *prop,
0223                                            xcb_generic_error_t **e);
0224 
0225 /* WM_COLORMAP_WINDOWS */
0226 
0227 /**
0228  * @brief Deliver a ChangeProperty request to set WM_COLORMAP_WINDOWS property value.
0229  * @param c The connection to the X server.
0230  * @param wm_colormap_windows The WM_COLORMAP_WINDOWS atom
0231  * @param window Window X identifier.
0232  * @param list_len Windows list len.
0233  * @param list Windows list.
0234  * @return The request cookie.
0235  */
0236 xcb_void_cookie_t xcb_icccm_set_wm_colormap_windows_checked(xcb_connection_t *c,
0237                                                               xcb_window_t window,
0238                                                               xcb_atom_t wm_colormap_windows_atom,
0239                                                               uint32_t list_len,
0240                                                               const xcb_window_t *list);
0241 
0242 /**
0243  * @see xcb_icccm_set_wm_colormap_windows_checked()
0244  */
0245 xcb_void_cookie_t xcb_icccm_set_wm_colormap_windows(xcb_connection_t *c,
0246                                                       xcb_window_t window,
0247                                                       xcb_atom_t wm_colormap_windows_atom,
0248                                                       uint32_t list_len,
0249                                                       const xcb_window_t *list);
0250 
0251 /**
0252  * @brief WM_COLORMAP_WINDOWS structure.
0253  */
0254 typedef struct {
0255 /** Length of the windows list */
0256 uint32_t windows_len;
0257 /** Windows list */
0258 xcb_window_t *windows;
0259 /** Store reply to avoid memory allocation, should normally not be
0260     used directly */
0261 xcb_get_property_reply_t *_reply;
0262 } xcb_icccm_get_wm_colormap_windows_reply_t;
0263 
0264 /**
0265  * @brief Send request to get WM_COLORMAP_WINDOWS property of a given window.
0266  * @param c The connection to the X server.
0267  * @param window Window X identifier.
0268  * @return The request cookie.
0269  */
0270 xcb_get_property_cookie_t xcb_icccm_get_wm_colormap_windows(xcb_connection_t *c,
0271                                                               xcb_window_t window,
0272                                                               xcb_atom_t wm_colormap_windows_atom);
0273 
0274 /**
0275  * @see xcb_icccm_get_wm_colormap_windows()
0276  */
0277 xcb_get_property_cookie_t xcb_icccm_get_wm_colormap_windows_unchecked(xcb_connection_t *c,
0278                                                                         xcb_window_t window,
0279                                                                         xcb_atom_t wm_colormap_windows_atom);
0280 
0281 /**
0282  * @brief Fill the given structure with the WM_COLORMAP_WINDOWS property of a window.
0283  * @param reply The reply of the GetProperty request.
0284  * @param colormap_windows WM_COLORMAP property value.
0285  * @return Return 1 on success, 0 otherwise.
0286  *
0287  * protocols structure members should be freed by
0288  * xcb_icccm_get_wm_protocols_reply_wipe().
0289  */
0290 uint8_t xcb_icccm_get_wm_colormap_windows_from_reply(xcb_get_property_reply_t *reply,
0291                                                        xcb_icccm_get_wm_colormap_windows_reply_t *colormap_windows);
0292 /**
0293  * @brief Fill the given structure with the WM_COLORMAP_WINDOWS property of a window.
0294  * @param c The connection to the X server.
0295  * @param cookie Request cookie.
0296  * @param protocols WM_COLORMAP_WINDOWS property value.
0297  * @param e Error if any.
0298  * @return Return 1 on success, 0 otherwise.
0299  *
0300  * The parameter e supplied to this function must be NULL if
0301  * xcb_icccm_get_wm_colormap_windows_unchecked() is used.  Otherwise, it
0302  * stores the error if any. protocols structure members should be
0303  * freed by xcb_icccm_get_wm_colormap_windows_reply_wipe().
0304  */
0305 uint8_t xcb_icccm_get_wm_colormap_windows_reply(xcb_connection_t *c,
0306                                                   xcb_get_property_cookie_t cookie,
0307                                                   xcb_icccm_get_wm_colormap_windows_reply_t *windows,
0308                                                   xcb_generic_error_t **e);
0309 
0310 /**
0311  * @brief Wipe protocols structure members previously allocated by
0312  *        xcb_icccm_get_wm_colormap_windows_reply().
0313  * @param windows windows structure whose members is going to be freed.
0314  */
0315 void xcb_icccm_get_wm_colormap_windows_reply_wipe(xcb_icccm_get_wm_colormap_windows_reply_t *windows);
0316 
0317 /* WM_CLIENT_MACHINE */
0318 
0319 /**
0320  * @brief Deliver a SetProperty request to set WM_CLIENT_MACHINE property value.
0321  * @param c The connection to the X server.
0322  * @param window Window X identifier.
0323  * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type.
0324  * @param format Encoding format.
0325  * @param name_len Length of name value to set.
0326  * @param name Name value to set.
0327  */
0328 xcb_void_cookie_t xcb_icccm_set_wm_client_machine_checked(xcb_connection_t *c,
0329                                                             xcb_window_t window,
0330                                                             xcb_atom_t encoding,
0331                                                             uint8_t format,
0332                                                             uint32_t name_len,
0333                                                             const char *name);
0334 
0335 /**
0336  * @see xcb_icccm_set_wm_client_machine_checked()
0337  */
0338 xcb_void_cookie_t xcb_icccm_set_wm_client_machine(xcb_connection_t *c,
0339                                                     xcb_window_t window,
0340                                                     xcb_atom_t encoding,
0341                                                     uint8_t format,
0342                                                     uint32_t name_len,
0343                                                     const char *name);
0344 
0345 /**
0346  * @brief Send request to get WM_CLIENT_MACHINE property of a window.
0347  * @param c The connection to the X server.
0348  * @param window Window X identifier.
0349  * @return The request cookie.
0350  */
0351 xcb_get_property_cookie_t xcb_icccm_get_wm_client_machine(xcb_connection_t *c,
0352                                                             xcb_window_t window);
0353 
0354 /**
0355  * @see xcb_icccm_get_wm_client_machine()
0356  */
0357 xcb_get_property_cookie_t xcb_icccm_get_wm_client_machine_unchecked(xcb_connection_t *c,
0358                                                                       xcb_window_t window);
0359 
0360 /**
0361  * @brief Fill given structure with the WM_CLIENT_MACHINE property of a window.
0362  * @param c The connection to the X server.
0363  * @param cookie Request cookie.
0364  * @param prop WM_CLIENT_MACHINE property value.
0365  * @param e Error if any.
0366  * @see xcb_icccm_get_text_property_reply()
0367  * @return Return 1 on success, 0 otherwise.
0368  */
0369 uint8_t xcb_icccm_get_wm_client_machine_reply(xcb_connection_t *c,
0370                                                 xcb_get_property_cookie_t cookie,
0371                                                 xcb_icccm_get_text_property_reply_t *prop,
0372                                                 xcb_generic_error_t **e);
0373 
0374 /* WM_CLASS */
0375 
0376 /**
0377  * @brief WM_CLASS hint structure
0378  */
0379 
0380 /**
0381  * @brief Deliver a SetProperty request to set WM_CLASS property value.
0382  *
0383  * WM_CLASS string is a concatenation of the instance and class name
0384  * strings respectively (including null character).
0385  *
0386  * @param c The connection to the X server.
0387  * @param window Window X identifier.
0388  * @param class_len Length of WM_CLASS string.
0389  * @param class_name WM_CLASS string.
0390  * @return The request cookie.
0391  */
0392 xcb_void_cookie_t xcb_icccm_set_wm_class_checked(xcb_connection_t *c,
0393                                                    xcb_window_t window,
0394                                                    uint32_t class_len,
0395                                                    const char *class_name);
0396 
0397 /**
0398  * @see xcb_icccm_set_wm_class_checked()
0399  */
0400 xcb_void_cookie_t xcb_icccm_set_wm_class(xcb_connection_t *c,
0401                                            xcb_window_t window,
0402                                            uint32_t class_len,
0403                                            const char *class_name);
0404 
0405 typedef struct {
0406 /** Instance name */
0407 char *instance_name;
0408 /** Class of application */
0409 char *class_name;
0410 /** Store reply to avoid memory allocation, should normally not be
0411     used directly */
0412 xcb_get_property_reply_t *_reply;
0413 } xcb_icccm_get_wm_class_reply_t;
0414 
0415 /**
0416  * @brief Deliver a GetProperty request to the X server for WM_CLASS.
0417  * @param c The connection to the X server.
0418  * @param window Window X identifier.
0419  * @return The request cookie.
0420  */
0421 xcb_get_property_cookie_t xcb_icccm_get_wm_class(xcb_connection_t *c,
0422                                                    xcb_window_t window);
0423 
0424 /**
0425  * @see xcb_icccm_get_wm_class()
0426  */
0427 xcb_get_property_cookie_t xcb_icccm_get_wm_class_unchecked(xcb_connection_t *c,
0428                                                              xcb_window_t window);
0429 
0430 
0431 /**
0432  * @brief Fill give structure with the WM_CLASS property of a window.
0433  * @param prop The property structure to fill.
0434  * @param reply The property request reply.
0435  * @return Return 1 on success, 0 otherwise.
0436  */
0437 uint8_t
0438 xcb_icccm_get_wm_class_from_reply(xcb_icccm_get_wm_class_reply_t *prop,
0439                                     xcb_get_property_reply_t *reply);
0440 
0441 /**
0442  * @brief Fill given structure with the WM_CLASS property of a window.
0443  * @param c The connection to the X server.
0444  * @param cookie Request cookie.
0445  * @param prop WM_CLASS property value.
0446  * @param e Error if any.
0447  * @return Return 1 on success, 0 otherwise.
0448  *
0449  * The parameter e supplied to this function must be NULL if
0450  * xcb_icccm_get_wm_class_unchecked() is used.  Otherwise, it stores the
0451  * error if any. prop structure members should be freed by
0452  * xcb_icccm_get_wm_class_reply_wipe().
0453  */
0454 uint8_t xcb_icccm_get_wm_class_reply(xcb_connection_t *c,
0455                                        xcb_get_property_cookie_t cookie,
0456                                        xcb_icccm_get_wm_class_reply_t *prop,
0457                                        xcb_generic_error_t **e);
0458 
0459 /**
0460  * @brief Wipe prop structure members previously allocated by
0461  *        xcb_icccm_get_wm_class_reply().
0462  * @param prop prop structure whose members is going to be freed.
0463  */
0464 void xcb_icccm_get_wm_class_reply_wipe(xcb_icccm_get_wm_class_reply_t *prop);
0465 
0466 /* WM_TRANSIENT_FOR */
0467 
0468 /**
0469  * @brief Deliver a SetProperty request to set WM_TRANSIENT_FOR property value.
0470  * @param c The connection to the X server.
0471  * @param window Window X identifier.
0472  * @param transient_for_window The WM_TRANSIENT_FOR window X identifier.
0473  * @return The request cookie.
0474  */
0475 xcb_void_cookie_t xcb_icccm_set_wm_transient_for_checked(xcb_connection_t *c,
0476                                                            xcb_window_t window,
0477                                                            xcb_window_t transient_for_window);
0478 
0479 /**
0480  * @see xcb_icccm_set_wm_transient_for
0481  */
0482 xcb_void_cookie_t xcb_icccm_set_wm_transient_for(xcb_connection_t *c,
0483                                                    xcb_window_t window,
0484                                                    xcb_window_t transient_for_window);
0485 
0486 /**
0487  * @brief Send request to get WM_TRANSIENT_FOR property of a window.
0488  * @param c The connection to the X server
0489  * @param window Window X identifier.
0490  * @return The request cookie.
0491  */
0492 xcb_get_property_cookie_t xcb_icccm_get_wm_transient_for(xcb_connection_t *c,
0493                                                            xcb_window_t window);
0494 
0495 /**
0496  * @see xcb_icccm_get_wm_transient_for_unchecked()
0497  */
0498 xcb_get_property_cookie_t xcb_icccm_get_wm_transient_for_unchecked(xcb_connection_t *c,
0499                                                                      xcb_window_t window);
0500 
0501 /**
0502  * @brief Fill given window pointer with the WM_TRANSIENT_FOR property of a window.
0503  * @param prop WM_TRANSIENT_FOR property value.
0504  * @param reply The get property request reply.
0505  * @return Return 1 on success, 0 otherwise.
0506  */
0507 uint8_t
0508 xcb_icccm_get_wm_transient_for_from_reply(xcb_window_t *prop,
0509                                             xcb_get_property_reply_t *reply);
0510 /**
0511  * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window.
0512  * @param c The connection to the X server.
0513  * @param cookie Request cookie.
0514  * @param prop WM_TRANSIENT_FOR property value.
0515  * @param e Error if any.
0516  * @return Return 1 on success, 0 otherwise.
0517  *
0518  * The parameter e supplied to this function must be NULL if
0519  * xcb_icccm_get_wm_transient_for_unchecked() is used.  Otherwise, it stores
0520  * the error if any.
0521  */
0522 uint8_t xcb_icccm_get_wm_transient_for_reply(xcb_connection_t *c,
0523                                                xcb_get_property_cookie_t cookie,
0524                                                xcb_window_t *prop,
0525                                                xcb_generic_error_t **e);
0526 
0527 /* WM_SIZE_HINTS */
0528 
0529 typedef enum {
0530 XCB_ICCCM_SIZE_HINT_US_POSITION = 1 << 0,
0531   XCB_ICCCM_SIZE_HINT_US_SIZE = 1 << 1,
0532   XCB_ICCCM_SIZE_HINT_P_POSITION = 1 << 2,
0533   XCB_ICCCM_SIZE_HINT_P_SIZE = 1 << 3,
0534   XCB_ICCCM_SIZE_HINT_P_MIN_SIZE = 1 << 4,
0535   XCB_ICCCM_SIZE_HINT_P_MAX_SIZE = 1 << 5,
0536   XCB_ICCCM_SIZE_HINT_P_RESIZE_INC = 1 << 6,
0537   XCB_ICCCM_SIZE_HINT_P_ASPECT = 1 << 7,
0538   XCB_ICCCM_SIZE_HINT_BASE_SIZE = 1 << 8,
0539   XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY = 1 << 9
0540   } xcb_icccm_size_hints_flags_t;
0541 
0542 /**
0543  * @brief Size hints structure.
0544  */
0545 typedef struct {
0546 /** User specified flags */
0547 uint32_t flags;
0548 /** User-specified position */
0549 int32_t x, y;
0550 /** User-specified size */
0551 int32_t width, height;
0552 /** Program-specified minimum size */
0553 int32_t min_width, min_height;
0554 /** Program-specified maximum size */
0555 int32_t max_width, max_height;
0556 /** Program-specified resize increments */
0557 int32_t width_inc, height_inc;
0558 /** Program-specified minimum aspect ratios */
0559 int32_t min_aspect_num, min_aspect_den;
0560 /** Program-specified maximum aspect ratios */
0561 int32_t max_aspect_num, max_aspect_den;
0562 /** Program-specified base size */
0563 int32_t base_width, base_height;
0564 /** Program-specified window gravity */
0565 uint32_t win_gravity;
0566 } xcb_size_hints_t;
0567 
0568 /** Number of elements in this structure */
0569 #define XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS 18
0570 
0571 /**
0572  * @brief Set size hints to a given position.
0573  * @param hints SIZE_HINTS structure.
0574  * @param user_specified Is the size user-specified?
0575  * @param x The X position.
0576  * @param y The Y position.
0577  */
0578 void xcb_icccm_size_hints_set_position(xcb_size_hints_t *hints, int user_specified,
0579                                          int32_t x, int32_t y);
0580 
0581 /**
0582  * @brief Set size hints to a given size.
0583  * @param hints SIZE_HINTS structure.
0584  * @param user_specified is the size user-specified?
0585  * @param width The width.
0586  * @param height The height.
0587  */
0588 void xcb_icccm_size_hints_set_size(xcb_size_hints_t *hints, int user_specified,
0589                                      int32_t width, int32_t height);
0590 
0591 /**
0592  * @brief Set size hints to a given minimum size.
0593  * @param hints SIZE_HINTS structure.
0594  * @param width The minimum width.
0595  * @param height The minimum height.
0596  */
0597 void xcb_icccm_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width,
0598                                          int32_t min_height);
0599 
0600 /**
0601  * @brief Set size hints to a given maximum size.
0602  * @param hints SIZE_HINTS structure.
0603  * @param width The maximum width.
0604  * @param height The maximum height.
0605  */
0606 void xcb_icccm_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width,
0607                                          int32_t max_height);
0608 
0609 /**
0610  * @brief Set size hints to a given resize increments.
0611  * @param hints SIZE_HINTS structure.
0612  * @param width The resize increments width.
0613  * @param height The resize increments height.
0614  */
0615 void xcb_icccm_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc,
0616                                            int32_t height_inc);
0617 
0618 /**
0619  * @brief Set size hints to a given aspect ratios.
0620  * @param hints SIZE_HINTS structure.
0621  * @param min_aspect_num The minimum aspect ratios for the width.
0622  * @param min_aspect_den The minimum aspect ratios for the height.
0623  * @param max_aspect_num The maximum aspect ratios for the width.
0624  * @param max_aspect_den The maximum aspect ratios for the height.
0625  */
0626 void xcb_icccm_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num,
0627                                        int32_t min_aspect_den, int32_t max_aspect_num,
0628                                      int32_t max_aspect_den);
0629 
0630 /**
0631  * @brief Set size hints to a given base size.
0632  * @param hints SIZE_HINTS structure.
0633  * @param base_width Base width.
0634  * @param base_height Base height.
0635  */
0636 void xcb_icccm_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width,
0637                                           int32_t base_height);
0638 
0639 /**
0640  * @brief Set size hints to a given window gravity.
0641  * @param hints SIZE_HINTS structure.
0642  * @param win_gravity Window gravity value.
0643  */
0644 void xcb_icccm_size_hints_set_win_gravity(xcb_size_hints_t *hints,
0645                                             xcb_gravity_t win_gravity);
0646 
0647 /**
0648  * @brief Deliver a ChangeProperty request to set a value to a given property.
0649  * @param c The connection to the X server.
0650  * @param window Window X identifier.
0651  * @param property Property to set value for.
0652  * @param hints Hints value to set.
0653  */
0654 xcb_void_cookie_t xcb_icccm_set_wm_size_hints_checked(xcb_connection_t *c,
0655                                                         xcb_window_t window,
0656                                                       xcb_atom_t property,
0657                                                       xcb_size_hints_t *hints);
0658 
0659 /**
0660  * @see xcb_icccm_set_wm_size_hints_checked()
0661  */
0662 xcb_void_cookie_t xcb_icccm_set_wm_size_hints(xcb_connection_t *c,
0663                                                 xcb_window_t window,
0664                                               xcb_atom_t property,
0665                                               xcb_size_hints_t *hints);
0666 
0667 /**
0668  * @brief Send request to get size hints structure for the named property.
0669  * @param c The connection to the X server.
0670  * @param window Window X identifier.
0671  * @param property Specify the property name.
0672  * @return The request cookie.
0673  */
0674 xcb_get_property_cookie_t xcb_icccm_get_wm_size_hints(xcb_connection_t *c,
0675                                                         xcb_window_t window,
0676                                                       xcb_atom_t property);
0677 
0678 /**
0679  * @see xcb_icccm_get_wm_size_hints()
0680  */
0681 xcb_get_property_cookie_t xcb_icccm_get_wm_size_hints_unchecked(xcb_connection_t *c,
0682                                                                   xcb_window_t window,
0683                                                                 xcb_atom_t property);
0684 
0685 /**
0686  * @brief Fill given structure with the size hints of the named property.
0687  * @param c The connection to the X server.
0688  * @param cookie Request cookie.
0689  * @param hints Size hints structure.
0690  * @param e Error if any.
0691  * @return Return 1 on success, 0 otherwise.
0692  *
0693  * The parameter e supplied to this function must be NULL if
0694  * xcb_icccm_get_wm_size_hints_unchecked() is used.  Otherwise, it stores
0695  * the error if any. The returned pointer should be freed.
0696  */
0697 uint8_t xcb_icccm_get_wm_size_hints_reply(xcb_connection_t *c,
0698                                             xcb_get_property_cookie_t cookie,
0699                                           xcb_size_hints_t *hints,
0700                                           xcb_generic_error_t **e);
0701 
0702 /* WM_NORMAL_HINTS */
0703 
0704 /**
0705  * @brief Deliver a ChangeProperty request to set WM_NORMAL_HINTS property value.
0706  * @param c The connection to the X server.
0707  * @param window Window X identifier.
0708  * @param hints Hints value to set.
0709  */
0710 xcb_void_cookie_t xcb_icccm_set_wm_normal_hints_checked(xcb_connection_t *c,
0711                                                           xcb_window_t window,
0712                                                         xcb_size_hints_t *hints);
0713 
0714 /**
0715  * @see xcb_icccm_set_wm_normal_hints_checked()
0716  */
0717 xcb_void_cookie_t xcb_icccm_set_wm_normal_hints(xcb_connection_t *c,
0718                                                   xcb_window_t window,
0719                                                 xcb_size_hints_t *hints);
0720 
0721 /**
0722  * @brief Send request to get WM_NORMAL_HINTS property of a window.
0723  * @param c The connection to the X server.
0724  * @param window Window X identifier.
0725  * @return The request cookie.
0726  */
0727 xcb_get_property_cookie_t xcb_icccm_get_wm_normal_hints(xcb_connection_t *c,
0728                                                           xcb_window_t window);
0729 
0730 /**
0731  * @see xcb_icccm_get_wm_normal_hints()
0732  */
0733 xcb_get_property_cookie_t xcb_icccm_get_wm_normal_hints_unchecked(xcb_connection_t *c,
0734                                                                     xcb_window_t window);
0735 
0736 /**
0737  * @brief Fill given structure with the WM_NORMAL_HINTS property of a window.
0738  * @param hints WM_NORMAL_HINTS property value.
0739  * @param reply The get property request reply.
0740  * @return Return 1 on success, 0 otherwise.
0741  */
0742 uint8_t
0743 xcb_icccm_get_wm_size_hints_from_reply(xcb_size_hints_t *hints,
0744                                          xcb_get_property_reply_t *reply);
0745 
0746 /**
0747  * @brief Fill given structure with the WM_NORMAL_HINTS property of a window.
0748  * @param c The connection to the X server.
0749  * @param cookie Request cookie.
0750  * @param hints WM_NORMAL_HINTS property value.
0751  * @param e Error if any.
0752  * @return Return 1 on success, 0 otherwise.
0753  *
0754  * The parameter e supplied to this function must be NULL if
0755  * xcb_icccm_get_wm_normal_hints_unchecked() is used.  Otherwise, it stores
0756  * the error if any. The returned pointer should be freed.
0757  */
0758 uint8_t xcb_icccm_get_wm_normal_hints_reply(xcb_connection_t *c,
0759                                               xcb_get_property_cookie_t cookie,
0760                                             xcb_size_hints_t *hints,
0761                                             xcb_generic_error_t **e);
0762 
0763 /* WM_HINTS */
0764 
0765 /**
0766  * @brief WM hints structure (may be extended in the future).
0767  */
0768 typedef struct {
0769 /** Marks which fields in this structure are defined */
0770 int32_t flags;
0771 /** Does this application rely on the window manager to get keyboard
0772     input? */
0773   uint32_t input;
0774   /** See below */
0775   int32_t initial_state;
0776   /** Pixmap to be used as icon */
0777   xcb_pixmap_t icon_pixmap;
0778   /** Window to be used as icon */
0779   xcb_window_t icon_window;
0780   /** Initial position of icon */
0781   int32_t icon_x, icon_y;
0782   /** Icon mask bitmap */
0783   xcb_pixmap_t icon_mask;
0784   /* Identifier of related window group */
0785   xcb_window_t window_group;
0786 } xcb_icccm_wm_hints_t;
0787 
0788 /** Number of elements in this structure */
0789 #define XCB_ICCCM_NUM_WM_HINTS_ELEMENTS 9
0790 
0791 /**
0792  * @brief WM_HINTS window states.
0793  */
0794 typedef enum {
0795   XCB_ICCCM_WM_STATE_WITHDRAWN = 0,
0796   XCB_ICCCM_WM_STATE_NORMAL = 1,
0797   XCB_ICCCM_WM_STATE_ICONIC = 3
0798 } xcb_icccm_wm_state_t;
0799 
0800 typedef enum {
0801   XCB_ICCCM_WM_HINT_INPUT = (1L << 0),
0802   XCB_ICCCM_WM_HINT_STATE = (1L << 1),
0803   XCB_ICCCM_WM_HINT_ICON_PIXMAP = (1L << 2),
0804   XCB_ICCCM_WM_HINT_ICON_WINDOW = (1L << 3),
0805   XCB_ICCCM_WM_HINT_ICON_POSITION = (1L << 4),
0806   XCB_ICCCM_WM_HINT_ICON_MASK = (1L << 5),
0807   XCB_ICCCM_WM_HINT_WINDOW_GROUP = (1L << 6),
0808   XCB_ICCCM_WM_HINT_X_URGENCY = (1L << 8)
0809 } xcb_icccm_wm_t;
0810 
0811 #define XCB_ICCCM_WM_ALL_HINTS (XCB_ICCCM_WM_HINT_INPUT | XCB_ICCCM_WM_HINT_STATE | \
0812                                 XCB_ICCCM_WM_HINT_ICON_PIXMAP | XCB_ICCCM_WM_HINT_ICON_WINDOW | \
0813                                 XCB_ICCCM_WM_HINT_ICON_POSITION | XCB_ICCCM_WM_HINT_ICON_MASK | \
0814                                 XCB_ICCCM_WM_HINT_WINDOW_GROUP)
0815 
0816 /**
0817  * @brief Get urgency hint.
0818  * @param hints WM_HINTS structure.
0819  * @return Urgency hint value.
0820  */
0821 uint32_t xcb_icccm_wm_hints_get_urgency(xcb_icccm_wm_hints_t *hints);
0822 
0823 /**
0824  * @brief Set input focus.
0825  * @param hints WM_HINTS structure.
0826  * @param input Input focus.
0827  */
0828 void xcb_icccm_wm_hints_set_input(xcb_icccm_wm_hints_t *hints, uint8_t input);
0829 
0830 /**
0831  * @brief Set hints state to 'iconic'.
0832  * @param hints WM_HINTS structure.
0833  */
0834 void xcb_icccm_wm_hints_set_iconic(xcb_icccm_wm_hints_t *hints);
0835 
0836 /**
0837  * @brief Set hints state to 'normal'.
0838  * @param hints WM_HINTS structure.
0839  */
0840 void xcb_icccm_wm_hints_set_normal(xcb_icccm_wm_hints_t *hints);
0841 
0842 /**
0843  * @brief Set hints state to 'withdrawn'.
0844  * @param hints WM_HINTS structure.
0845  */
0846 void xcb_icccm_wm_hints_set_withdrawn(xcb_icccm_wm_hints_t *hints);
0847 
0848 /**
0849  * @brief Set hints state to none.
0850  * @param hints WM_HINTS structure.
0851  */
0852 void xcb_icccm_wm_hints_set_none(xcb_icccm_wm_hints_t *hints);
0853 
0854 /**
0855  * @brief Set pixmap to be used as icon.
0856  * @param hints WM_HINTS structure.
0857  * @param icon_pixmap Pixmap.
0858  */
0859 void xcb_icccm_wm_hints_set_icon_pixmap(xcb_icccm_wm_hints_t *hints,
0860                                         xcb_pixmap_t icon_pixmap);
0861 
0862 /**
0863  * @brief Set icon mask bitmap.
0864  * @param hints WM_HINTS structure.
0865  * @param icon_mask Pixmap.
0866  */
0867 void xcb_icccm_wm_hints_set_icon_mask(xcb_icccm_wm_hints_t *hints, xcb_pixmap_t icon_mask);
0868 
0869 /**
0870  * @brief Set window identifier to be used as icon.
0871  * @param hints WM_HINTS structure.
0872  * @param icon_window Window X identifier.
0873  */
0874 void xcb_icccm_wm_hints_set_icon_window(xcb_icccm_wm_hints_t *hints,
0875                                         xcb_window_t icon_window);
0876 
0877 /**
0878  * @brief Set identifier of related window group.
0879  * @param hints WM_HINTS structure.
0880  * @param window_group Window X identifier.
0881  */
0882 void xcb_icccm_wm_hints_set_window_group(xcb_icccm_wm_hints_t *hints,
0883                                          xcb_window_t window_group);
0884 
0885 /**
0886  * @brief Set urgency hints flag.
0887  * @param hints WM_HINTS structure.
0888  */
0889 void xcb_icccm_wm_hints_set_urgency(xcb_icccm_wm_hints_t *hints);
0890 
0891 /**
0892  * @brief Deliver a SetProperty request to set WM_HINTS property value.
0893  * @param c The connection to the X server.
0894  * @param window Window X identifier.
0895  * @param hints Hints value to set.
0896  */
0897 xcb_void_cookie_t xcb_icccm_set_wm_hints_checked(xcb_connection_t *c,
0898                                                  xcb_window_t window,
0899                                                  xcb_icccm_wm_hints_t *hints);
0900 
0901 /**
0902  * @see xcb_icccm_set_wm_hints_checked()
0903  */
0904 xcb_void_cookie_t xcb_icccm_set_wm_hints(xcb_connection_t *c,
0905                                          xcb_window_t window,
0906                                          xcb_icccm_wm_hints_t *hints);
0907 
0908 /**
0909  * @brief Send request to get WM_HINTS property of a window.
0910  * @param c The connection to the X server.
0911  * @param window Window X identifier.
0912  * @return The request cookie.
0913  */
0914 xcb_get_property_cookie_t xcb_icccm_get_wm_hints(xcb_connection_t *c,
0915                                                  xcb_window_t window);
0916 
0917 /**
0918  * @see xcb_icccm_get_wm_hints()
0919  */
0920 xcb_get_property_cookie_t xcb_icccm_get_wm_hints_unchecked(xcb_connection_t *c,
0921                                                            xcb_window_t window);
0922 
0923 /**
0924  * @brief Fill given structure with the WM_HINTS property of a window.
0925  * @param hints WM_HINTS property value.
0926  * @param reply The get property request reply.
0927  * @return Return 1 on success, 0 otherwise.
0928  */
0929 uint8_t
0930 xcb_icccm_get_wm_hints_from_reply(xcb_icccm_wm_hints_t *hints,
0931                                   xcb_get_property_reply_t *reply);
0932 
0933 /**
0934  * @brief Fill given structure with the WM_HINTS property of a window.
0935  * @param c The connection to the X server.
0936  * @param cookie Request cookie.
0937  * @param hints WM_HINTS property value.
0938  * @param e Error if any.
0939  * @return Return 1 on success, 0 otherwise.
0940  *
0941  * The parameter e supplied to this function must be NULL if
0942  * xcb_icccm_get_wm_hints_unchecked() is used.  Otherwise, it stores the
0943  * error if any. The returned pointer should be freed.
0944  */
0945 uint8_t xcb_icccm_get_wm_hints_reply(xcb_connection_t *c,
0946                                      xcb_get_property_cookie_t cookie,
0947                                      xcb_icccm_wm_hints_t *hints,
0948                                      xcb_generic_error_t **e);
0949 
0950 /* WM_PROTOCOLS */
0951 
0952 /**
0953  * @brief Deliver a SetProperty request to set WM_PROTOCOLS property value.
0954  * @param c The connection to the X server.
0955  * @param wm_protocols The WM_PROTOCOLS atom.
0956  * @param window Window X identifier.
0957  * @param list_len Atom list len.
0958  * @param list Atom list.
0959  */
0960 xcb_void_cookie_t xcb_icccm_set_wm_protocols_checked(xcb_connection_t *c,
0961                                                      xcb_window_t window,
0962                                                      xcb_atom_t wm_protocols,
0963                                                      uint32_t list_len,
0964                                                      xcb_atom_t *list);
0965 
0966 /**
0967  * @see xcb_icccm_set_wm_protocols_checked()
0968  */
0969 xcb_void_cookie_t xcb_icccm_set_wm_protocols(xcb_connection_t *c,
0970                                              xcb_window_t window,
0971                                              xcb_atom_t wm_protocols,
0972                                              uint32_t list_len,
0973                                              xcb_atom_t *list);
0974 
0975 /**
0976  * @brief WM_PROTOCOLS structure.
0977  */
0978 typedef struct {
0979   /** Length of the atoms list */
0980   uint32_t atoms_len;
0981   /** Atoms list */
0982   xcb_atom_t *atoms;
0983   /** Store reply to avoid memory allocation, should normally not be
0984       used directly */
0985   xcb_get_property_reply_t *_reply;
0986 } xcb_icccm_get_wm_protocols_reply_t;
0987 
0988 /**
0989  * @brief Send request to get WM_PROTOCOLS property of a given window.
0990  * @param c The connection to the X server.
0991  * @param window Window X identifier.
0992  * @return The request cookie.
0993  */
0994 xcb_get_property_cookie_t xcb_icccm_get_wm_protocols(xcb_connection_t *c,
0995                                                      xcb_window_t window,
0996                                                      xcb_atom_t wm_protocol_atom);
0997 
0998 /**
0999  * @see xcb_icccm_get_wm_protocols()
1000  */
1001 xcb_get_property_cookie_t xcb_icccm_get_wm_protocols_unchecked(xcb_connection_t *c,
1002                                                                xcb_window_t window,
1003                                                                xcb_atom_t wm_protocol_atom);
1004 
1005 /**
1006  * @brief Fill the given structure with the WM_PROTOCOLS property of a window.
1007  * @param reply The reply of the GetProperty request.
1008  * @param protocols WM_PROTOCOLS property value.
1009  * @return Return 1 on success, 0 otherwise.
1010  *
1011  * protocols structure members should be freed by
1012  * xcb_icccm_get_wm_protocols_reply_wipe().
1013  */
1014 uint8_t xcb_icccm_get_wm_protocols_from_reply(xcb_get_property_reply_t *reply,
1015                                               xcb_icccm_get_wm_protocols_reply_t *protocols);
1016 /**
1017  * @brief Fill the given structure with the WM_PROTOCOLS property of a window.
1018  * @param c The connection to the X server.
1019  * @param cookie Request cookie.
1020  * @param protocols WM_PROTOCOLS property value.
1021  * @param e Error if any.
1022  * @return Return 1 on success, 0 otherwise.
1023  *
1024  * The parameter e supplied to this function must be NULL if
1025  * xcb_icccm_get_wm_protocols_unchecked() is used.  Otherwise, it stores the
1026  * error if any. protocols structure members should be freed by
1027  * xcb_icccm_get_wm_protocols_reply_wipe().
1028  */
1029 uint8_t xcb_icccm_get_wm_protocols_reply(xcb_connection_t *c,
1030                                          xcb_get_property_cookie_t cookie,
1031                                          xcb_icccm_get_wm_protocols_reply_t *protocols,
1032                                          xcb_generic_error_t **e);
1033 
1034 /**
1035  * @brief Wipe protocols structure members previously allocated by
1036  *        xcb_icccm_get_wm_protocols_reply().
1037  * @param protocols protocols structure whose members is going to be freed.
1038  */
1039 void xcb_icccm_get_wm_protocols_reply_wipe(xcb_icccm_get_wm_protocols_reply_t *protocols);
1040 
1041 #ifdef __cplusplus
1042 }
1043 #endif
1044 
1045 /**
1046  * @}
1047  */
1048 
1049 #endif /* __XCB_ICCCM_H__ */