[Xcb-commit] xcb-util

Vincent Torri doursse at kemper.freedesktop.org
Fri Jul 28 08:30:01 PDT 2006


 xcb-util/icccm/icccm.c |   97 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 77 insertions(+), 20 deletions(-)

New commits:
diff-tree 924f1ad85bb023c228e56fa95c21734ebfee76ab (from df6268f3259cb2dc8c2c69a9a1d528d5ea6c7524)
Author: TORRI Vincent <torri at doursse.(none)>
Date:   Fri Jul 28 17:28:26 2006 +0200

    add GetWMIconName and WM_CLIENT_MACHINE functions

diff --git a/xcb-util/icccm/icccm.c b/xcb-util/icccm/icccm.c
index f8d55f3..91a6f1c 100644
--- a/xcb-util/icccm/icccm.c
+++ b/xcb-util/icccm/icccm.c
@@ -3,29 +3,20 @@
 #include "xcb_icccm.h"
 #include "xcb_atom.h"
 
-/* WM_NAME */
 
-void
-SetWMName (XCBConnection *c,
-	   XCBWINDOW      window,
-	   XCBATOM        encoding,
-	   CARD32         name_len,
-	   const char    *name)
-{
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_NAME, encoding, 8, name_len, name);
-}
-
-int
-GetWMName (XCBConnection *c,
-	   XCBWINDOW      window,
-	   CARD8         *format,
-	   XCBATOM       *encoding,
-	   CARD32        *name_len,
-	   char         **name)
+static int
+GetTextProperty(XCBConnection *c,
+                XCBWINDOW      window,
+                XCBATOM        property;
+                CARD8         *format,
+                XCBATOM       *encoding,
+                CARD32        *name_len,
+                char         **name)
 {
 	XCBGetPropertyCookie cookie;
 	XCBGetPropertyRep *reply;
-	cookie = GetAnyProperty(c, 0, window, WM_NAME, 128);
+
+	cookie = GetAnyProperty(c, 0, window, property, 128);
 	reply = XCBGetPropertyReply(c, cookie, 0);
 	if(!reply)
 		return 0;
@@ -34,7 +25,7 @@ GetWMName (XCBConnection *c,
 	*name_len = XCBGetPropertyValueLength(reply) * *format / 8;
 	if(reply->bytes_after)
 	{
-		cookie = XCBGetProperty(c, 0, window, WM_NAME, reply->type, 0, *name_len);
+		cookie = XCBGetProperty(c, 0, window, property, reply->type, 0, *name_len);
 		free(reply);
 		reply = XCBGetPropertyReply(c, cookie, 0);
 		if(!reply)
@@ -45,6 +36,29 @@ GetWMName (XCBConnection *c,
 	return 1;
 }
 
+/* WM_NAME */
+
+void
+SetWMName (XCBConnection *c,
+	   XCBWINDOW      window,
+	   XCBATOM        encoding,
+	   CARD32         name_len,
+	   const char    *name)
+{
+	XCBChangeProperty(c, XCBPropModeReplace, window, WM_NAME, encoding, 8, name_len, name);
+}
+
+int
+GetWMName (XCBConnection *c,
+	   XCBWINDOW      window,
+	   CARD8         *format,
+	   XCBATOM       *encoding,
+	   CARD32        *name_len,
+	   char         **name)
+{
+	return GetTextProperty(c, window, WM_NAME, format, encoding, name_len, name);
+}
+
 void
 WatchWMName (PropertyHandlers      *prophs,
 	     CARD32                 long_len,
@@ -66,6 +80,17 @@ SetWMIconName (XCBConnection *c,
 	XCBChangeProperty(c, XCBPropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name);
 }
 
+int
+GetWMIconName (XCBConnection *c,
+               XCBWINDOW      window,
+               CARD8         *format,
+               XCBATOM       *encoding,
+               CARD32        *name_len,
+               char         **name)
+{
+	return GetTextProperty(c, window, WM_ICON_NAME, format, encoding, name_len, name);
+}
+
 void
 WatchWMIconName (PropertyHandlers      *prophs,
 		 CARD32                 long_len,
@@ -75,6 +100,38 @@ WatchWMIconName (PropertyHandlers      *
 	SetPropertyHandler(prophs, WM_ICON_NAME, long_len, handler, data);
 }
 
+/* WM_CLIENT_MACHINE */
+
+void
+SetWMClientMachine (XCBConnection *c,
+                    XCBWINDOW      window,
+                    XCBATOM        encoding,
+                    CARD32         name_len,
+                    const char    *name)
+{
+	XCBChangeProperty(c, XCBPropModeReplace, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
+}
+
+int
+GetWMClientMachine (XCBConnection *c,
+                    XCBWINDOW      window,
+                    CARD8         *format,
+                    XCBATOM       *encoding,
+                    CARD32        *name_len,
+                    char         **name)
+{
+	return GetTextProperty(c, window, WM_CLIENT_MACHINE, format, encoding, name_len, name);
+}
+
+void
+WatchWMClientMachine (PropertyHandlers      *prophs,
+                      CARD32                 long_len,
+                      GenericPropertyHandler handler,
+                      void                  *data)
+{
+	SetPropertyHandler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
+}
+
 /* WM_SIZE_HINTS */
 
 typedef enum {


More information about the xcb-commit mailing list