[Xcb-commit] icccm

Julien Danjou jdanjou at kemper.freedesktop.org
Sat Jun 21 15:25:21 PDT 2008


 icccm/icccm.c     |   28 ++++++++++++++++++++++++++++
 icccm/xcb_icccm.h |    5 +++++
 2 files changed, 33 insertions(+)

New commits:
commit 3f5e9c98cc3c4ae59564c0bd3d5d1ded10bb7850
Author: Julien Danjou <julien at danjou.info>
Date:   Sun Jun 22 00:24:55 2008 +0200

    icccm: add xcb_get_wm_transient_for()
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

diff --git a/icccm/icccm.c b/icccm/icccm.c
index ec4aaa1..2a908ff 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -162,6 +162,34 @@ xcb_watch_wm_client_machine (xcb_property_handlers_t        *prophs,
 	xcb_set_property_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
 }
 
+/* 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 prop_q;
+    xcb_get_property_reply_t *prop_r;
+
+    prop_q = xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1);
+    prop_r = xcb_get_property_reply(c, prop_q, NULL);
+
+    if(!prop_r)
+        return 0;
+
+    if(prop_r->type != WINDOW || prop_r->format != 32 || !prop_r->length)
+    {
+        *prop_win = XCB_NONE;
+        free(prop_r);
+        return 0;
+    }
+
+    *prop_win = *((xcb_window_t *) xcb_get_property_value(prop_r));
+    free(prop_r);
+
+    return 1;
+}
+
 /* WM_SIZE_HINTS */
 
 struct xcb_size_hints_t {
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index ca73d40..8e1bcda 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -88,6 +88,11 @@ void xcb_watch_wm_client_machine (xcb_property_handlers_t        *prophs,
                                   xcb_generic_property_handler_t handler,
                                   void                          *data);
 
+/* WM_TRANSIENT_FOR */
+int xcb_get_wm_transient_for (xcb_connection_t *c,
+                              xcb_window_t      window,
+                              xcb_window_t      *prop_win);
+
 /* WM_SIZE_HINTS */
 
 typedef enum {


More information about the xcb-commit mailing list