[PATCH 1/3] icccm: add missing setters for WM_CLASS and WM_TRANSIENT_FOR properties

Arnaud Fontaine ArnaudFontainearnau at debian.org
Mon Mar 22 04:38:32 PDT 2010


---
 icccm/icccm.c     |   41 +++++++++++++++++++++++++++++++++++++++++
 icccm/xcb_icccm.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/icccm/icccm.c b/icccm/icccm.c
index f94ace1..65f4b10 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -233,6 +233,28 @@ xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs, uint32_t long_len,
 
 /* WM_CLASS */
 
+xcb_void_cookie_t
+xcb_set_wm_class_checked(xcb_connection_t *c,
+                         xcb_window_t window,
+                         uint32_t class_len,
+                         const char *class)
+{
+  return xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window,
+                                     XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8,
+                                     class_len, class);
+}
+
+xcb_void_cookie_t
+xcb_set_wm_class(xcb_connection_t *c,
+                 xcb_window_t window,
+                 uint32_t class_len,
+                 const char *class)
+{
+  return xcb_change_property(c, XCB_PROP_MODE_REPLACE, window,
+                             XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8,
+                             class_len, class);
+}
+
 xcb_get_property_cookie_t
 xcb_get_wm_class(xcb_connection_t *c, xcb_window_t window)
 {
@@ -284,6 +306,25 @@ xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop)
 
 /* WM_TRANSIENT_FOR */
 
+xcb_void_cookie_t
+xcb_set_wm_transient_for_checked(xcb_connection_t *c, xcb_window_t window,
+                                 xcb_window_t transient_for_window)
+{
+  return xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window,
+                                     XCB_ATOM_WM_TRANSIENT_FOR,
+                                     XCB_ATOM_WINDOW, 32, 1,
+                                     &transient_for_window);
+}
+
+xcb_void_cookie_t
+xcb_set_wm_transient_for(xcb_connection_t *c, xcb_window_t window,
+                         xcb_window_t transient_for_window)
+{
+  return xcb_change_property(c, XCB_PROP_MODE_REPLACE, window,
+                             XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
+                             1, &transient_for_window);
+}
+
 xcb_get_property_cookie_t
 xcb_get_wm_transient_for(xcb_connection_t *c, xcb_window_t window)
 {
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 2d80ffb..bae77d9 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -307,6 +307,32 @@ uint8_t xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs,
 /**
  * @brief WM_CLASS hint structure
  */
+
+/**
+ * @brief Deliver a SetProperty request to set WM_CLASS property value.
+ *
+ * WM_CLASS string is a concatenation of the instance and class name
+ * strings respectively (including null character).
+ *
+ * @param c The connection to the X server.
+ * @param window Window X identifier.
+ * @param class_len Length of WM_CLASS string.
+ * @param class WM_CLASS string.
+ * @return The request cookie.
+ */
+xcb_void_cookie_t xcb_set_wm_class_checked(xcb_connection_t *c,
+                                           xcb_window_t window,
+                                           uint32_t class_len,
+                                           const char *class);
+
+/**
+ * @see xcb_set_wm_class_checked()
+ */
+xcb_void_cookie_t xcb_set_wm_class(xcb_connection_t *c,
+                                   xcb_window_t window,
+                                   uint32_t class_len,
+                                   const char *class);
+
 typedef struct {
   /** Instance name */
   char *instance_name;
@@ -371,6 +397,24 @@ void xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop);
 /* WM_TRANSIENT_FOR */
 
 /**
+ * @brief Deliver a SetProperty request to set WM_TRANSIENT_FOR property value.
+ * @param c The connection to the X server.
+ * @param window Window X identifier.
+ * @param transient_for_window The WM_TRANSIENT_FOR window X identifier.
+ * @return The request cookie.
+ */
+xcb_void_cookie_t xcb_set_wm_transient_for_checked(xcb_connection_t *c,
+                                                   xcb_window_t window,
+                                                   xcb_window_t transient_for_window);
+
+/**
+ * @see xcb_set_wm_transient_for
+ */
+xcb_void_cookie_t xcb_set_wm_transient_for(xcb_connection_t *c,
+                                           xcb_window_t window,
+                                           xcb_window_t transient_for_window);
+
+/**
  * @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.
-- 
1.7.0


--=-=-=--


More information about the Xcb mailing list