diff options
author | Arnaud Fontaine <arnau@debian.org> | 2008-08-25 00:00:54 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2008-09-15 11:39:09 +0200 |
commit | f716a0b910ab0c6dd3e4ff4d844dde5345be787e (patch) | |
tree | f6808b9bc93870a3655f33b7285107dca769c524 | |
parent | 2d15ce5ff16b40388d0fef65f12c70d2cfb264d3 (diff) |
[icccm] Make xcb_get_wm_transient_for() asynchronous and document the code.
-rw-r--r-- | icccm/icccm.c | 44 | ||||
-rw-r--r-- | icccm/xcb_icccm.h | 35 |
2 files changed, 57 insertions, 22 deletions
diff --git a/icccm/icccm.c b/icccm/icccm.c index 749ef70..695b69e 100644 --- a/icccm/icccm.c +++ b/icccm/icccm.c @@ -208,31 +208,37 @@ xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs, } /* WM_TRANSIENT_FOR */ -int -xcb_get_wm_transient_for (xcb_connection_t *c, - xcb_window_t window, - xcb_window_t *prop_win) + +xcb_get_property_cookie_t +xcb_get_wm_transient_for(xcb_connection_t *c, xcb_window_t window) { - xcb_get_property_cookie_t prop_q; - xcb_get_property_reply_t *prop_r; + return xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1); +} - prop_q = xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1); - prop_r = xcb_get_property_reply(c, prop_q, NULL); +xcb_get_property_cookie_t +xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_property_unchecked(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1); +} - if(!prop_r) - return 0; +uint8_t +xcb_get_wm_transient_for_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_window_t *prop, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); - if(prop_r->type != WINDOW || prop_r->format != 32 || !prop_r->length) - { - *prop_win = XCB_NONE; - free(prop_r); - return 0; - } + if(!reply || reply->type != WINDOW || reply->format != 32 || !reply->length) + { + free(reply); + return 0; + } - *prop_win = *((xcb_window_t *) xcb_get_property_value(prop_r)); - free(prop_r); + *prop = *((xcb_window_t *) xcb_get_property_value(reply)); - return 1; + free(reply); + return 1; } /* WM_SIZE_HINTS */ diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h index 108c9bb..5b50fae 100644 --- a/icccm/xcb_icccm.h +++ b/icccm/xcb_icccm.h @@ -216,9 +216,38 @@ void xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs, void *data); /* WM_TRANSIENT_FOR */ -int xcb_get_wm_transient_for (xcb_connection_t *c, - xcb_window_t window, - xcb_window_t *prop_win); + +/** + * @brief Send request to get WM_TRANSIENT_FOR property of a window. + * @param c: The connection to the X server + * @param window: Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_transient_for(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_transient_for_unchecked() + */ +xcb_get_property_cookie_t xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window. + * @param c: The connection to the X server. + * @param cookie: Request cookie. + * @param prop: WM_TRANSIENT_FOR property value. + * @param e: Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_transient_for_unchecked() is used. Otherwise, it stores + * the error if any. + */ +uint8_t xcb_get_wm_transient_for_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_window_t *prop, + xcb_generic_error_t **e); /* WM_SIZE_HINTS */ |