[PATCH 1/2] icccm: add WM_COLORMAP_WINDOWS

Arnaud Fontaine ArnaudFontainearnau at debian.org
Tue Mar 23 04:47:26 PDT 2010


---
 icccm/icccm.c     |   78 +++++++++++++++++++++++++++++++++++++++++++++
 icccm/xcb_icccm.h |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 170 insertions(+), 0 deletions(-)

diff --git a/icccm/icccm.c b/icccm/icccm.c
index 5ba851b..a2d4b6d 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -182,6 +182,84 @@ xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len,
 				  data);
 }
 
+/* WM_COLORMAP_WINDOWS */
+
+xcb_void_cookie_t
+xcb_set_wm_colormap_windows_checked(xcb_connection_t *c,
+                                    xcb_window_t window,
+                                    xcb_atom_t wm_colormap_windows_atom,
+                                    uint32_t list_len,
+                                    const xcb_window_t *list)
+{
+  return xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window,
+                                     wm_colormap_windows_atom, XCB_ATOM_WINDOW,
+                                     32, list_len, list);
+}
+
+xcb_void_cookie_t
+xcb_set_wm_colormap_windows(xcb_connection_t *c,
+                            xcb_window_t window,
+                            xcb_atom_t wm_colormap_windows_atom,
+                            uint32_t list_len,
+                            const xcb_atom_t *list)
+{
+  return xcb_change_property(c, XCB_PROP_MODE_REPLACE, window,
+                             wm_colormap_windows_atom, XCB_ATOM_WINDOW, 32,
+                             list_len, list);
+}
+
+
+xcb_get_property_cookie_t
+xcb_get_wm_colormap_windows(xcb_connection_t *c,
+                            xcb_window_t window,
+                            xcb_atom_t wm_colormap_windows_atom )
+{
+  return xcb_get_property(c, 0, window, wm_colormap_windows_atom,
+                          XCB_ATOM_WINDOW, 0, UINT_MAX);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_colormap_windows_unchecked(xcb_connection_t *c,
+                                      xcb_window_t window,
+                                      xcb_atom_t wm_colormap_windows_atom)
+{
+  return xcb_get_property_unchecked(c, 0, window, wm_colormap_windows_atom,
+                                    XCB_ATOM_WINDOW, 0, UINT_MAX);
+}
+
+uint8_t
+xcb_get_wm_colormap_windows_from_reply(xcb_get_property_reply_t *reply,
+                                       xcb_get_wm_colormap_windows_reply_t *colormap_windows)
+{
+  if(!reply || reply->type != XCB_ATOM_WINDOW || reply->format != 32)
+    return 0;
+
+  colormap_windows->_reply = reply;
+  colormap_windows->windows_len = xcb_get_property_value_length(colormap_windows->_reply) /  (reply->format / 8);
+  colormap_windows->windows = (xcb_window_t *) xcb_get_property_value(colormap_windows->_reply);
+
+  return 1;
+}
+
+uint8_t
+xcb_get_wm_colormap_windows_reply(xcb_connection_t *c,
+                                  xcb_get_property_cookie_t cookie,
+                                  xcb_get_wm_colormap_windows_reply_t *colormap_windows,
+                                  xcb_generic_error_t **e)
+{
+  xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+  uint8_t ret = xcb_get_wm_colormap_windows_from_reply(reply, colormap_windows);
+  if(!ret)
+    free(reply);
+  return ret;
+}
+
+void
+xcb_get_wm_colormap_windows_reply_wipe(xcb_get_wm_colormap_windows_reply_t *colormap_windows)
+{
+  free(colormap_windows->_reply);
+}
+
 /* WM_CLIENT_MACHINE */
 
 xcb_void_cookie_t
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 6545c15..b958a98 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -245,6 +245,98 @@ uint8_t xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs,
 			       xcb_generic_property_handler_t handler,
 			       void *data);
 
+/* WM_COLORMAP_WINDOWS */
+
+/**
+ * @brief Deliver a ChangeProperty request to set WM_COLORMAP_WINDOWS property value.
+ * @param c The connection to the X server.
+ * @param wm_colormap_windows The WM_COLORMAP_WINDOWS atom
+ * @param window Window X identifier.
+ * @param list_len Windows list len.
+ * @param list Windows list.
+ * @return The request cookie.
+ */
+xcb_void_cookie_t xcb_set_wm_colormap_windows_checked(xcb_connection_t *c,
+                                                      xcb_window_t window,
+                                                      xcb_atom_t wm_colormap_windows_atom,
+                                                      uint32_t list_len,
+                                                      const xcb_window_t *list);
+
+/**
+ * @see xcb_set_wm_colormap_windows_checked()
+ */
+xcb_void_cookie_t xcb_set_wm_colormap_windows(xcb_connection_t *c,
+                                              xcb_window_t window,
+                                              xcb_atom_t wm_colormap_windows_atom,
+                                              uint32_t list_len,
+                                              const xcb_window_t *list);
+
+/**
+ * @brief WM_COLORMAP_WINDOWS structure.
+ */
+typedef struct {
+  /** Length of the windows list */
+  uint32_t windows_len;
+  /** Windows list */
+  xcb_window_t *windows;
+  /** Store reply to avoid memory allocation, should normally not be
+      used directly */
+  xcb_get_property_reply_t *_reply;
+} xcb_get_wm_colormap_windows_reply_t;
+
+/**
+ * @brief Send request to get WM_COLORMAP_WINDOWS property of a given 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_colormap_windows(xcb_connection_t *c,
+                                                      xcb_window_t window,
+                                                      xcb_atom_t wm_colormap_windows_atom);
+
+/**
+ * @see xcb_get_wm_colormap_windows()
+ */
+xcb_get_property_cookie_t xcb_get_wm_colormap_windows_unchecked(xcb_connection_t *c,
+                                                                xcb_window_t window,
+                                                                xcb_atom_t wm_colormap_windows_atom);
+
+/**
+ * @brief Fill the given structure with the WM_COLORMAP_WINDOWS property of a window.
+ * @param reply The reply of the GetProperty request.
+ * @param colormap_windows WM_COLORMAP property value.
+ * @return Return 1 on success, 0 otherwise.
+ *
+ * protocols structure members should be freed by
+ * xcb_get_wm_protocols_reply_wipe().
+ */
+uint8_t xcb_get_wm_colormap_windows_from_reply(xcb_get_property_reply_t *reply,
+                                               xcb_get_wm_colormap_windows_reply_t *colormap_windows);
+/**
+ * @brief Fill the given structure with the WM_COLORMAP_WINDOWS property of a window.
+ * @param c The connection to the X server.
+ * @param cookie Request cookie.
+ * @param protocols WM_COLORMAP_WINDOWS 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_colormap_windows_unchecked() is used.  Otherwise, it
+ * stores the error if any. protocols structure members should be
+ * freed by xcb_get_wm_colormap_windows_reply_wipe().
+ */
+uint8_t xcb_get_wm_colormap_windows_reply(xcb_connection_t *c,
+                                          xcb_get_property_cookie_t cookie,
+                                          xcb_get_wm_colormap_windows_reply_t *windows,
+                                          xcb_generic_error_t **e);
+
+/**
+ * @brief Wipe protocols structure members previously allocated by
+ *        xcb_get_wm_colormap_windows_reply().
+ * @param windows windows structure whose members is going to be freed.
+ */
+void xcb_get_wm_colormap_windows_reply_wipe(xcb_get_wm_colormap_windows_reply_t *windows);
+
 /* WM_CLIENT_MACHINE */
 
 /**
-- 
1.7.0


--=-=-=--


More information about the Xcb mailing list