diff options
author | Arnaud Fontaine <arnau@debian.org> | 2011-04-23 13:40:24 +0900 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2011-04-23 13:53:29 +0900 |
commit | 14d15ad5f895a09d846bc7c1ffe8bf67c7948da0 (patch) | |
tree | ab0004b04dd720feed5359343e7ab4c8a9f405f6 /ewmh | |
parent | 6c99de50a858bd82bc1562c74c728f03c49d399f (diff) |
Fix setters for _NET_WM_ICON to allow more than one icon.
Only one icon could be given at a time, thus add append setters to
only set one icon at a time in a convenient way and make the general
setters more generic.
Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Diffstat (limited to 'ewmh')
-rw-r--r-- | ewmh/ewmh.c.m4 | 26 | ||||
-rw-r--r-- | ewmh/xcb_ewmh.h.m4 | 59 |
2 files changed, 63 insertions, 22 deletions
diff --git a/ewmh/ewmh.c.m4 b/ewmh/ewmh.c.m4 index 42c419f..8b7747c 100644 --- a/ewmh/ewmh.c.m4 +++ b/ewmh/ewmh.c.m4 @@ -1107,35 +1107,33 @@ set_wm_icon_data(uint32_t data[], uint32_t width, uint32_t height, } xcb_void_cookie_t -xcb_ewmh_set_wm_icon_checked(xcb_ewmh_connection_t *ewmh, - xcb_window_t window, - uint32_t width, uint32_t height, - uint32_t img_len, uint32_t *img) +xcb_ewmh_append_wm_icon_checked(xcb_ewmh_connection_t *ewmh, + xcb_window_t window, + uint32_t width, uint32_t height, + uint32_t img_len, uint32_t *img) { const uint32_t data_len = img_len + 2; uint32_t data[data_len]; set_wm_icon_data(data, width, height, img_len, img); - return xcb_change_property_checked(ewmh->connection, XCB_PROP_MODE_REPLACE, - window, ewmh->_NET_WM_ICON, - XCB_ATOM_CARDINAL, 32, data_len, data); + return xcb_ewmh_set_wm_icon_checked(ewmh, XCB_PROP_MODE_APPEND, window, + data_len, data); } xcb_void_cookie_t -xcb_ewmh_set_wm_icon(xcb_ewmh_connection_t *ewmh, - xcb_window_t window, - uint32_t width, uint32_t height, - uint32_t img_len, uint32_t *img) +xcb_ewmh_append_wm_icon(xcb_ewmh_connection_t *ewmh, + xcb_window_t window, + uint32_t width, uint32_t height, + uint32_t img_len, uint32_t *img) { const uint32_t data_len = img_len + 2; uint32_t data[data_len]; set_wm_icon_data(data, width, height, img_len, img); - return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, window, - ewmh->_NET_WM_ICON, XCB_ATOM_CARDINAL, 32, - data_len, data); + return xcb_ewmh_set_wm_icon(ewmh, XCB_PROP_MODE_APPEND, window, + data_len, data); } DO_GET_PROPERTY(wm_icon, _NET_WM_ICON, XCB_ATOM_CARDINAL, UINT_MAX) diff --git a/ewmh/xcb_ewmh.h.m4 b/ewmh/xcb_ewmh.h.m4 index 048d020..bb85797 100644 --- a/ewmh/xcb_ewmh.h.m4 +++ b/ewmh/xcb_ewmh.h.m4 @@ -2011,15 +2011,58 @@ uint8_t xcb_ewmh_get_wm_icon_geometry_reply(xcb_ewmh_connection_t *ewmh, xcb_ewmh_geometry_t *icons, xcb_generic_error_t **e); -xcb_void_cookie_t xcb_ewmh_set_wm_icon_checked(xcb_ewmh_connection_t *ewmh, - xcb_window_t window, - uint32_t width, uint32_t height, - uint32_t img_len, uint32_t *img); +/** + * @brief Send ChangeProperty request to set _NET_WM_ICON window + * property. The given data is considered to be already + * prepared, namely that it is an array such as: WIDTH1, + * HEIGHT1, IMG1, WIDTH2, HEIGHT2, IMG2. + * + * If you only want to add or append a single icon, you may + * consider using xcb_ewmh_append_wm_icon_checked which is far + * easier to use. + * + * _NET_WM_ICON CARDINAL[][2+n]/32 + * + * @param ewmh The information relative to EWMH + * @param mode ChangeProperty mode (xcb_prop_mode_t) + * @param window The window to set the property on + * @param data_len Length of the data + * @param data The data + */ +static inline xcb_void_cookie_t +xcb_ewmh_set_wm_icon_checked(xcb_ewmh_connection_t *ewmh, + uint8_t mode, + xcb_window_t window, + uint32_t data_len, uint32_t *data) +{ + return xcb_change_property_checked(ewmh->connection, mode, + window, ewmh->_NET_WM_ICON, + XCB_ATOM_CARDINAL, 32, data_len, data); +} -xcb_void_cookie_t xcb_ewmh_set_wm_icon(xcb_ewmh_connection_t *ewmh, - xcb_window_t window, - uint32_t width, uint32_t height, - uint32_t img_len, uint32_t *img); +/** + * @see xcb_ewmh_set_wm_icon_checked + */ +static inline xcb_void_cookie_t +xcb_ewmh_set_wm_icon(xcb_ewmh_connection_t *ewmh, + uint8_t mode, + xcb_window_t window, + uint32_t data_len, uint32_t *data) +{ + return xcb_change_property(ewmh->connection, mode, window, + ewmh->_NET_WM_ICON, XCB_ATOM_CARDINAL, 32, + data_len, data); +} + +xcb_void_cookie_t xcb_ewmh_append_wm_icon_checked(xcb_ewmh_connection_t *ewmh, + xcb_window_t window, + uint32_t width, uint32_t height, + uint32_t img_len, uint32_t *img); + +xcb_void_cookie_t xcb_ewmh_append_wm_icon(xcb_ewmh_connection_t *ewmh, + xcb_window_t window, + uint32_t width, uint32_t height, + uint32_t img_len, uint32_t *img); xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_unchecked(xcb_ewmh_connection_t *ewmh, xcb_window_t window); |