From 2555a72e633368f48abee919cf727ea1eb9b8b7b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 28 Jul 2008 17:54:33 +0200 Subject: [PATCH] xutil: use xcb_get_wm_transient_for instead of xutil fct Signed-off-by: Julien Danjou --- client.c | 3 ++- common/xutil.c | 36 ------------------------------------ common/xutil.h | 3 --- event.c | 3 ++- 4 files changed, 4 insertions(+), 41 deletions(-) diff --git a/client.c b/client.c index 1f729d94..83828059 100644 --- a/client.c +++ b/client.c @@ -23,6 +23,7 @@ #include #include +#include #include "client.h" #include "tag.h" @@ -405,7 +406,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen) ewmh_check_client_hints(c); /* check for transient and set tags like its parent */ - if((rettrans = xutil_get_transient_for_hint(globalconf.connection, w, &trans)) + if((rettrans = xcb_get_wm_transient_for(globalconf.connection, w, &trans)) && (t = client_getbywin(trans))) { tag_array_t *tags = &globalconf.screens[c->screen].tags; diff --git a/common/xutil.c b/common/xutil.c index 96f36345..1f05172d 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -117,42 +117,6 @@ xutil_getlockmask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms, p_delete(&modmap_r); } -/** Equivalent to 'XGetTransientForHint' which is actually a - * 'XGetWindowProperty' which gets the WM_TRANSIENT_FOR property of - * the specified window - * \param c X connection - * \param win get the property from this window - * \param prop_win returns the WM_TRANSIENT_FOR property of win - * \return return true if successfull - */ -bool -xutil_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win, - xcb_window_t *prop_win) -{ - xcb_get_property_reply_t *t_hint_r; - - /* Use checked because the error handler should not take care of - * this error as we only return a boolean */ - t_hint_r = xcb_get_property_reply(c, - xcb_get_property_unchecked(c, false, win, - WM_TRANSIENT_FOR, - WINDOW, 0, 1), - NULL); - - if(!t_hint_r || t_hint_r->type != WINDOW || t_hint_r->format != 32 || - t_hint_r->length == 0) - { - *prop_win = XCB_NONE; - p_delete(&t_hint_r); - return false; - } - - *prop_win = *((xcb_window_t *) xcb_get_property_value(t_hint_r)); - p_delete(&t_hint_r); - - return true; -} - bool xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win, xutil_class_hint_t *ch) { diff --git a/common/xutil.h b/common/xutil.h index c5815cad..de1f4ef8 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -85,9 +85,6 @@ #define LastExtensionError 255 /* End of macros not defined in XCB */ -/* Common function defined in Xlib but not in XCB */ -bool xutil_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *); - typedef struct { char *res_name; diff --git a/event.c b/event.c index 6efd36df..6deb4905 100644 --- a/event.c +++ b/event.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "event.h" #include "tag.h" @@ -521,7 +522,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)), { if(ev->atom == WM_TRANSIENT_FOR) { - xutil_get_transient_for_hint(connection, c->win, &trans); + xcb_get_wm_transient_for(connection, c->win, &trans); if(!c->isfloating && (c->isfloating = (client_getbywin(trans) != NULL))) globalconf.screens[c->screen].need_arrange = true;