[Xcb-commit] 14 commits - atom configure.ac icccm property
Julien Danjou
jdanjou at kemper.freedesktop.org
Mon Sep 15 02:40:49 PDT 2008
atom/atoms.gperf.m4 | 74 +++
atom/xcb_atom.h.m4 | 4
configure.ac | 3
icccm/Makefile.am | 1
icccm/icccm.c | 983 +++++++++++++++++++-------------------------
icccm/xcb_icccm.h | 1056 ++++++++++++++++++++++++++++++++++++------------
property/prop.c | 12
property/xcb_property.h | 5
8 files changed, 1331 insertions(+), 807 deletions(-)
New commits:
commit 70792aa9975f08de55c85bb61005a03eb3550ffb
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Sep 8 17:46:42 2008 +0200
[icccm] Bump library version number to 0.3.0.
diff --git a/configure.ac b/configure.ac
index b8c0bb3..6e6968a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.57)
-AC_INIT([xcb-util],0.2.1,[xcb at lists.freedesktop.org])
+AC_INIT([xcb-util],0.3.0,[xcb at lists.freedesktop.org])
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
diff --git a/icccm/Makefile.am b/icccm/Makefile.am
index 07a9d8c..9ad4238 100644
--- a/icccm/Makefile.am
+++ b/icccm/Makefile.am
@@ -11,6 +11,7 @@ libxcb_icccm_la_SOURCES = icccm.c
libxcb_icccm_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_ATOM_CFLAGS) $(XCB_EVENT_CFLAGS) \
$(XCB_PROPERTY_CFLAGS)
libxcb_icccm_la_LIBADD = $(XCB_LIBS) $(XCB_ATOM_LIBS) $(XCB_PROPERTY_LIBS)
+libxcb_icccm_la_LDFLAGS = -version-info 1:0:0
pkgconfig_DATA = xcb-icccm.pc
commit 58b1ce4331b7658cadb1942bfe6dfc62534d0c83
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Sep 8 17:46:23 2008 +0200
[icccm] Comment and indent the code properly.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index e90cf72..4afa63b 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -77,23 +77,20 @@ void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop)
/* WM_NAME */
void
-xcb_set_wm_name_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_name_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name)
{
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8, name_len, name);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_NAME,
+ encoding, 8, name_len, name);
}
void
-xcb_set_wm_name (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_name(xcb_connection_t *c, xcb_window_t window, xcb_atom_t encoding,
+ uint32_t name_len, const char *name)
{
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8, name_len, name);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8,
+ name_len, name);
}
xcb_get_property_cookie_t
@@ -120,34 +117,29 @@ xcb_get_wm_name_reply(xcb_connection_t *c,
}
void
-xcb_watch_wm_name (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data)
+xcb_watch_wm_name(xcb_property_handlers_t *prophs, uint32_t long_len,
+ xcb_generic_property_handler_t handler, void *data)
{
- xcb_set_property_handler(prophs, WM_NAME, long_len, handler, data);
+ xcb_set_property_handler(prophs, WM_NAME, long_len, handler, data);
}
/* WM_ICON_NAME */
void
-xcb_set_wm_icon_name_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_icon_name_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name)
{
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding, 8, name_len, name);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME,
+ encoding, 8, name_len, name);
}
void
-xcb_set_wm_icon_name (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_icon_name(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len, const char *name)
{
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding, 8, name_len, name);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding,
+ 8, name_len, name);
}
xcb_get_property_cookie_t
@@ -174,34 +166,30 @@ xcb_get_wm_icon_name_reply(xcb_connection_t *c,
}
void
-xcb_watch_wm_icon_name (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data)
+xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len,
+ xcb_generic_property_handler_t handler, void *data)
{
- xcb_set_property_handler(prophs, WM_ICON_NAME, long_len, handler, data);
+ xcb_set_property_handler(prophs, WM_ICON_NAME, long_len, handler, data);
}
/* WM_CLIENT_MACHINE */
void
-xcb_set_wm_client_machine_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_client_machine_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name)
{
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window,
+ WM_CLIENT_MACHINE, encoding, 8, name_len, name);
}
void
-xcb_set_wm_client_machine (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name)
+xcb_set_wm_client_machine(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name)
{
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE,
+ encoding, 8, name_len, name);
}
xcb_get_property_cookie_t
@@ -228,12 +216,10 @@ xcb_get_wm_client_machine_reply(xcb_connection_t *c,
}
void
-xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data)
+xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs, uint32_t long_len,
+ xcb_generic_property_handler_t handler, void *data)
{
- xcb_set_property_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
+ xcb_set_property_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
}
/* WM_CLASS */
@@ -316,113 +302,100 @@ xcb_get_wm_transient_for_reply(xcb_connection_t *c,
/* WM_SIZE_HINTS */
void
-xcb_size_hints_set_position (xcb_size_hints_t *hints,
- int user_specified,
- int32_t x,
- int32_t y)
+xcb_size_hints_set_position(xcb_size_hints_t *hints, int user_specified,
+ int32_t x, int32_t y)
{
- hints->flags &= ~(XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_P_POSITION);
- if (user_specified)
- hints->flags |= XCB_SIZE_HINT_US_POSITION;
- else
- hints->flags |= XCB_SIZE_HINT_P_POSITION;
- hints->x = x;
- hints->y = y;
+ hints->flags &= ~(XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_P_POSITION);
+ if (user_specified)
+ hints->flags |= XCB_SIZE_HINT_US_POSITION;
+ else
+ hints->flags |= XCB_SIZE_HINT_P_POSITION;
+ hints->x = x;
+ hints->y = y;
}
void
-xcb_size_hints_set_size (xcb_size_hints_t *hints,
- int user_specified,
- int32_t width,
- int32_t height)
+xcb_size_hints_set_size(xcb_size_hints_t *hints, int user_specified,
+ int32_t width, int32_t height)
{
- hints->flags &= ~(XCB_SIZE_HINT_US_SIZE | XCB_SIZE_HINT_P_SIZE);
- if (user_specified)
- hints->flags |= XCB_SIZE_HINT_US_SIZE;
- else
- hints->flags |= XCB_SIZE_HINT_P_SIZE;
- hints->width = width;
- hints->height = height;
+ hints->flags &= ~(XCB_SIZE_HINT_US_SIZE | XCB_SIZE_HINT_P_SIZE);
+ if (user_specified)
+ hints->flags |= XCB_SIZE_HINT_US_SIZE;
+ else
+ hints->flags |= XCB_SIZE_HINT_P_SIZE;
+ hints->width = width;
+ hints->height = height;
}
void
-xcb_size_hints_set_min_size (xcb_size_hints_t *hints,
- int32_t min_width,
- int32_t min_height)
+xcb_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width,
+ int32_t min_height)
{
- hints->flags |= XCB_SIZE_HINT_P_MIN_SIZE;
- hints->min_width = min_width;
- hints->min_height = min_height;
+ hints->flags |= XCB_SIZE_HINT_P_MIN_SIZE;
+ hints->min_width = min_width;
+ hints->min_height = min_height;
}
void
-xcb_size_hints_set_max_size (xcb_size_hints_t *hints,
- int32_t max_width,
- int32_t max_height)
+xcb_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width,
+ int32_t max_height)
{
- hints->flags |= XCB_SIZE_HINT_P_MAX_SIZE;
- hints->max_width = max_width;
- hints->max_height = max_height;
+ hints->flags |= XCB_SIZE_HINT_P_MAX_SIZE;
+ hints->max_width = max_width;
+ hints->max_height = max_height;
}
void
-xcb_size_hints_set_resize_inc (xcb_size_hints_t *hints,
- int32_t width_inc,
- int32_t height_inc)
+xcb_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc,
+ int32_t height_inc)
{
- hints->flags |= XCB_SIZE_HINT_P_RESIZE_INC;
- hints->width_inc = width_inc;
- hints->height_inc = height_inc;
+ hints->flags |= XCB_SIZE_HINT_P_RESIZE_INC;
+ hints->width_inc = width_inc;
+ hints->height_inc = height_inc;
}
void
-xcb_size_hints_set_aspect (xcb_size_hints_t *hints,
- int32_t min_aspect_num,
- int32_t min_aspect_den,
- int32_t max_aspect_num,
- int32_t max_aspect_den)
+xcb_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num,
+ int32_t min_aspect_den, int32_t max_aspect_num,
+ int32_t max_aspect_den)
{
- hints->flags |= XCB_SIZE_HINT_P_ASPECT;
- hints->min_aspect_num = min_aspect_num;
- hints->min_aspect_den = min_aspect_den;
- hints->max_aspect_num = max_aspect_num;
- hints->max_aspect_den = max_aspect_den;
+ hints->flags |= XCB_SIZE_HINT_P_ASPECT;
+ hints->min_aspect_num = min_aspect_num;
+ hints->min_aspect_den = min_aspect_den;
+ hints->max_aspect_num = max_aspect_num;
+ hints->max_aspect_den = max_aspect_den;
}
void
-xcb_size_hints_set_base_size (xcb_size_hints_t *hints,
- int32_t base_width,
- int32_t base_height)
+xcb_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width,
+ int32_t base_height)
{
- hints->flags |= XCB_SIZE_HINT_BASE_SIZE;
- hints->base_width = base_width;
- hints->base_height = base_height;
+ hints->flags |= XCB_SIZE_HINT_BASE_SIZE;
+ hints->base_width = base_width;
+ hints->base_height = base_height;
}
void
-xcb_size_hints_set_win_gravity (xcb_size_hints_t *hints,
- uint8_t win_gravity)
+xcb_size_hints_set_win_gravity(xcb_size_hints_t *hints, uint8_t win_gravity)
{
- hints->flags |= XCB_SIZE_HINT_P_WIN_GRAVITY;
- hints->win_gravity = win_gravity;
+ hints->flags |= XCB_SIZE_HINT_P_WIN_GRAVITY;
+ hints->win_gravity = win_gravity;
}
void
-xcb_set_wm_size_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- xcb_size_hints_t *hints)
+xcb_set_wm_size_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property, xcb_size_hints_t *hints)
{
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, property,
+ WM_SIZE_HINTS, 32, sizeof(*hints) >> 2, hints);
}
void
-xcb_set_wm_size_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- xcb_size_hints_t *hints)
+xcb_set_wm_size_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property, xcb_size_hints_t *hints)
{
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, property,
+ WM_SIZE_HINTS, 32, sizeof(*hints) >> 2, hints);
}
xcb_get_property_cookie_t
@@ -486,19 +459,17 @@ xcb_get_wm_size_hints_reply(xcb_connection_t *c, xcb_get_property_cookie_t cooki
/* WM_NORMAL_HINTS */
void
-xcb_set_wm_normal_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_size_hints_t *hints)
+xcb_set_wm_normal_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_size_hints_t *hints)
{
- xcb_set_wm_size_hints_checked(c, window, WM_NORMAL_HINTS, hints);
+ xcb_set_wm_size_hints_checked(c, window, WM_NORMAL_HINTS, hints);
}
void
-xcb_set_wm_normal_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_size_hints_t *hints)
+xcb_set_wm_normal_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_size_hints_t *hints)
{
- xcb_set_wm_size_hints(c, window, WM_NORMAL_HINTS, hints);
+ xcb_set_wm_size_hints(c, window, WM_NORMAL_HINTS, hints);
}
xcb_get_property_cookie_t
@@ -527,91 +498,91 @@ xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
uint32_t
xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints)
{
- return (hints->flags & XCB_WM_HINT_X_URGENCY);
+ return (hints->flags & XCB_WM_HINT_X_URGENCY);
}
void
xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input)
{
- hints->input = input;
- hints->flags |= XCB_WM_HINT_INPUT;
+ hints->input = input;
+ hints->flags |= XCB_WM_HINT_INPUT;
}
void
xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_STATE_ICONIC;
- hints->flags |= XCB_WM_HINT_STATE;
+ hints->initial_state = XCB_WM_STATE_ICONIC;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_normal(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_STATE_NORMAL;
- hints->flags |= XCB_WM_HINT_STATE;
+ hints->initial_state = XCB_WM_STATE_NORMAL;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_STATE_WITHDRAWN;
- hints->flags |= XCB_WM_HINT_STATE;
+ hints->initial_state = XCB_WM_STATE_WITHDRAWN;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_none(xcb_wm_hints_t *hints)
{
- hints->flags &= ~XCB_WM_HINT_STATE;
+ hints->flags &= ~XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints, xcb_pixmap_t icon_pixmap)
{
- hints->icon_pixmap = icon_pixmap;
- hints->flags |= XCB_WM_HINT_ICON_PIXMAP;
+ hints->icon_pixmap = icon_pixmap;
+ hints->flags |= XCB_WM_HINT_ICON_PIXMAP;
}
void
xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask)
{
- hints->icon_mask = icon_mask;
- hints->flags |= XCB_WM_HINT_ICON_MASK;
+ hints->icon_mask = icon_mask;
+ hints->flags |= XCB_WM_HINT_ICON_MASK;
}
void
xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints, xcb_window_t icon_window)
{
- hints->icon_window = icon_window;
- hints->flags |= XCB_WM_HINT_ICON_WINDOW;
+ hints->icon_window = icon_window;
+ hints->flags |= XCB_WM_HINT_ICON_WINDOW;
}
void
xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints, xcb_window_t window_group)
{
- hints->window_group = window_group;
- hints->flags |= XCB_WM_HINT_WINDOW_GROUP;
+ hints->window_group = window_group;
+ hints->flags |= XCB_WM_HINT_WINDOW_GROUP;
}
void
xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints)
{
- hints->flags |= XCB_WM_HINT_X_URGENCY;
+ hints->flags |= XCB_WM_HINT_X_URGENCY;
}
void
-xcb_set_wm_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_wm_hints_t *hints)
+xcb_set_wm_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_wm_hints_t *hints)
{
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32, sizeof(*hints) / 4, hints);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS,
+ WM_HINTS, 32, sizeof(*hints) >> 2, hints);
}
void
-xcb_set_wm_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_wm_hints_t *hints)
+xcb_set_wm_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_wm_hints_t *hints)
{
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32, sizeof(*hints) / 4, hints);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32,
+ sizeof(*hints) >> 2, hints);
}
xcb_get_property_cookie_t xcb_get_wm_hints(xcb_connection_t *c,
@@ -677,8 +648,7 @@ xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols,
}
xcb_get_property_cookie_t
-xcb_get_wm_protocols(xcb_connection_t *c,
- xcb_window_t window,
+xcb_get_wm_protocols(xcb_connection_t *c, xcb_window_t window,
xcb_atom_t wm_protocol_atom)
{
return xcb_get_property(c, 0, window, wm_protocol_atom, ATOM, 0, UINT_MAX);
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 202e2b8..217b9cc 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -102,17 +102,26 @@ void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop);
/* WM_NAME */
-void xcb_set_wm_name_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @brief Deliver a SetProperty request to set WM_NAME property value.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param encoding: Encoding used.
+ * @param name_len: Length of name value to set.
+ * @param name: Name value to set.
+ */
+void xcb_set_wm_name_checked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t encoding,
+ uint32_t name_len,
+ const char *name);
-void xcb_set_wm_name (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @see xcb_set_wm_name_checked()
+ */
+void xcb_set_wm_name(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name);
/**
* @brief Deliver a GetProperty request to the X server for WM_NAME.
@@ -143,24 +152,36 @@ uint8_t xcb_get_wm_name_reply(xcb_connection_t *c,
xcb_get_text_property_reply_t *prop,
xcb_generic_error_t **e);
-void xcb_watch_wm_name (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data);
+/**
+ * @brief Set a callback on WM_NAME property changes.
+ * @param prophs: Property handlers.
+ * @param long_len: Length of data.
+ * @param handler: The callback.
+ * @param data: data given to the callback.
+ */
+void xcb_watch_wm_name(xcb_property_handlers_t *prophs, uint32_t long_len,
+ xcb_generic_property_handler_t handler, void *data);
/* WM_ICON_NAME */
-void xcb_set_wm_icon_name_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @brief Deliver a SetProperty request to set WM_ICON_NAME property value.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param encoding: Encoding used.
+ * @param name_len: Length of name value to set.
+ * @param name: Name value to set.
+ */
+void xcb_set_wm_icon_name_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name);
-void xcb_set_wm_icon_name (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @see xcb_set_wm_icon_name_checked()
+ */
+void xcb_set_wm_icon_name(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name);
/**
* @brief Send request to get WM_ICON_NAME property of a window.
@@ -191,24 +212,37 @@ uint8_t xcb_get_wm_icon_name_reply(xcb_connection_t *c,
xcb_get_text_property_reply_t *prop,
xcb_generic_error_t **e);
-void xcb_watch_wm_icon_name (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data);
+/**
+ * @brief Set a callback on WM_ICON_NAME property changes.
+ * @param prophs: Property handlers.
+ * @param long_len: Length of data.
+ * @param handler: The callback.
+ * @param data: data given to the callback.
+ */
+void xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len,
+ xcb_generic_property_handler_t handler,
+ void *data);
/* WM_CLIENT_MACHINE */
-void xcb_set_wm_client_machine_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @brief Deliver a SetProperty request to set WM_CLIENT_MACHINE property value.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param encoding: Encoding used.
+ * @param name_len: Length of name value to set.
+ * @param name: Name value to set.
+ */
+void xcb_set_wm_client_machine_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name);
-void xcb_set_wm_client_machine (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t encoding,
- uint32_t name_len,
- const char *name);
+/**
+ * @see xcb_set_wm_client_machine_checked()
+ */
+void xcb_set_wm_client_machine(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t encoding, uint32_t name_len,
+ const char *name);
/**
* @brief Send request to get WM_CLIENT_MACHINE property of a window.
@@ -239,10 +273,17 @@ uint8_t xcb_get_wm_client_machine_reply(xcb_connection_t *c,
xcb_get_text_property_reply_t *prop,
xcb_generic_error_t **e);
-void xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
- uint32_t long_len,
- xcb_generic_property_handler_t handler,
- void *data);
+/**
+ * @brief Set a callback on WM_CLIENT_MACHINE property changes.
+ * @param prophs: Property handlers.
+ * @param long_len: Length of data.
+ * @param handler: The callback.
+ * @param data: data given to the callback.
+ */
+void xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs,
+ uint32_t long_len,
+ xcb_generic_property_handler_t handler,
+ void *data);
/* WM_CLASS */
@@ -374,50 +415,97 @@ typedef struct {
uint32_t win_gravity;
} xcb_size_hints_t;
-void xcb_size_hints_set_position (xcb_size_hints_t *hints,
- int user_specified,
- int32_t x,
- int32_t y);
+/**
+ * @brief Set size hints to a given position.
+ * @param hints: SIZE_HINTS structure.
+ * @param user_specified: Is the size user-specified?
+ * @param x: The X position.
+ * @param y: The Y position.
+ */
+void xcb_size_hints_set_position(xcb_size_hints_t *hints, int user_specified,
+ int32_t x, int32_t y);
-void xcb_size_hints_set_size (xcb_size_hints_t *hints,
- int user_specified,
- int32_t width,
- int32_t height);
+/**
+ * @brief Set size hints to a given size.
+ * @param hints: SIZE_HINTS structure.
+ * @param user_specified: is the size user-specified?
+ * @param width: The width.
+ * @param height: The height.
+ */
+void xcb_size_hints_set_size(xcb_size_hints_t *hints, int user_specified,
+ int32_t width, int32_t height);
-void xcb_size_hints_set_min_size (xcb_size_hints_t *hints,
- int32_t min_width,
- int32_t min_height);
+/**
+ * @brief Set size hints to a given minimum size.
+ * @param hints: SIZE_HINTS structure.
+ * @param width: The minimum width.
+ * @param height: The minimum height.
+ */
+void xcb_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width,
+ int32_t min_height);
-void xcb_size_hints_set_max_size (xcb_size_hints_t *hints,
- int32_t max_width,
- int32_t max_height);
+/**
+ * @brief Set size hints to a given maximum size.
+ * @param hints: SIZE_HINTS structure.
+ * @param width: The maximum width.
+ * @param height: The maximum height.
+ */
+void xcb_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width,
+ int32_t max_height);
-void xcb_size_hints_set_resize_inc (xcb_size_hints_t *hints,
- int32_t width_inc,
- int32_t height_inc);
+/**
+ * @brief Set size hints to a given resize increments.
+ * @param hints: SIZE_HINTS structure.
+ * @param width: The resize increments width.
+ * @param height: The resize increments height.
+ */
+void xcb_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc,
+ int32_t height_inc);
-void xcb_size_hints_set_aspect (xcb_size_hints_t *hints,
- int32_t min_aspect_num,
- int32_t min_aspect_den,
- int32_t max_aspect_num,
- int32_t max_aspect_den);
+/**
+ * @brief Set size hints to a given aspect ratios.
+ * @param hints: SIZE_HINTS structure.
+ * @param min_aspect_num: The minimum aspect ratios for the width.
+ * @param min_aspect_den: The minimum aspect ratios for the height.
+ * @param max_aspect_num: The maximum aspect ratios for the width.
+ * @param max_aspect_den: The maximum aspect ratios for the height.
+ */
+void xcb_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num,
+ int32_t min_aspect_den, int32_t max_aspect_num,
+ int32_t max_aspect_den);
-void xcb_size_hints_set_base_size (xcb_size_hints_t *hints,
- int32_t base_width,
- int32_t base_height);
+/**
+ * @brief Set size hints to a given base size.
+ * @param hints: SIZE_HINTS structure.
+ * @param base_width: Base width.
+ * @param base_height: Base height.
+ */
+void xcb_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width,
+ int32_t base_height);
-void xcb_size_hints_set_win_gravity (xcb_size_hints_t *hints,
- uint8_t win_gravity);
+/**
+ * @brief Set size hints to a given window gravity.
+ * @param hints: SIZE_HINTS structure.
+ * @param win_gravity: Window gravity value.
+ */
+void xcb_size_hints_set_win_gravity(xcb_size_hints_t *hints,
+ uint8_t win_gravity);
-void xcb_set_wm_size_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- xcb_size_hints_t *hints);
+/**
+ * @brief Deliver a ChangeProperty request to set a value to a given property.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param property: Property to set value for.
+ * @param hints: Hints value to set.
+ */
+void xcb_set_wm_size_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property, xcb_size_hints_t *hints);
-void xcb_set_wm_size_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- xcb_size_hints_t *hints);
+/**
+ * @see xcb_set_wm_size_hints_checked()
+ */
+void xcb_set_wm_size_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property, xcb_size_hints_t *hints);
/**
* @brief Send request to get size hints structure for the named property.
@@ -456,13 +544,20 @@ uint8_t xcb_get_wm_size_hints_reply(xcb_connection_t *c,
/* WM_NORMAL_HINTS */
-void xcb_set_wm_normal_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_size_hints_t *hints);
+/**
+ * @brief Deliver a ChangeProperty request to set WM_NORMAL_HINTS property value.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param hints: Hints value to set.
+ */
+void xcb_set_wm_normal_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_size_hints_t *hints);
-void xcb_set_wm_normal_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_size_hints_t *hints);
+/**
+ * @see xcb_set_wm_normal_hints_checked()
+ */
+void xcb_set_wm_normal_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_size_hints_t *hints);
/**
* @brief Send request to get WM_NORMAL_HINTS property of a window.
@@ -521,8 +616,12 @@ typedef struct {
xcb_window_t window_group;
} xcb_wm_hints_t;
-#define XCB_NUM_WM_HINTS_ELEMENTS 9 /* number of elements in this structure */
+/** Number of elements in this structure */
+#define XCB_NUM_WM_HINTS_ELEMENTS 9
+/**
+ * @brief WM_HINTS window states.
+ */
typedef enum {
XCB_WM_STATE_WITHDRAWN = 0,
XCB_WM_STATE_NORMAL = 1,
@@ -540,30 +639,100 @@ typedef enum {
XCB_WM_HINT_X_URGENCY = (1L << 8)
} xcb_wm_t;
-#define XCB_WM_ALL_HINTS (XCB_WM_HINT_INPUT | XCB_WM_HINT_STATE | XCB_WM_HINT_ICON_PIXMAP | \
- XCB_WM_HINT_ICON_WINDOW | XCB_WM_HINT_ICON_POSITION | XCB_WM_HINT_ICON_MASK | \
+#define XCB_WM_ALL_HINTS (XCB_WM_HINT_INPUT | XCB_WM_HINT_STATE |\
+ XCB_WM_HINT_ICON_PIXMAP | XCB_WM_HINT_ICON_WINDOW |\
+ XCB_WM_HINT_ICON_POSITION | XCB_WM_HINT_ICON_MASK |\
XCB_WM_HINT_WINDOW_GROUP)
+/**
+ * @brief Get urgency hint.
+ * @param hints: WM_HINTS structure.
+ * @return Urgency hint value.
+ */
uint32_t xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_input (xcb_wm_hints_t *hints, uint8_t input);
-void xcb_wm_hints_set_iconic (xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_normal (xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_withdrawn (xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_none (xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_icon_pixmap (xcb_wm_hints_t *hints, xcb_pixmap_t icon_pixmap);
-void xcb_wm_hints_set_icon_mask (xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask);
-void xcb_wm_hints_set_icon_window (xcb_wm_hints_t *hints, xcb_window_t icon_window);
-void xcb_wm_hints_set_window_group (xcb_wm_hints_t *hints, xcb_window_t window_group);
-void xcb_wm_hints_set_urgency (xcb_wm_hints_t *hints);
-
-void xcb_set_wm_hints_checked (xcb_connection_t *c,
- xcb_window_t window,
- xcb_wm_hints_t *hints);
-
-void xcb_set_wm_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_wm_hints_t *hints);
+/**
+ * @brief Set input focus.
+ * @param hints: WM_HINTS structure.
+ * @param input: Input focus.
+ */
+void xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input);
+
+/**
+ * @brief Set hints state to 'iconic'.
+ * @param hints: WM_HINTS structure.
+ */
+void xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints);
+
+/**
+ * @brief Set hints state to 'normal'.
+ * @param hints: WM_HINTS structure.
+ */
+void xcb_wm_hints_set_normal(xcb_wm_hints_t *hints);
+
+/**
+ * @brief Set hints state to 'withdrawn'.
+ * @param hints: WM_HINTS structure.
+ */
+void xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints);
+
+/**
+ * @brief Set hints state to none.
+ * @param hints: WM_HINTS structure.
+ */
+void xcb_wm_hints_set_none(xcb_wm_hints_t *hints);
+
+/**
+ * @brief Set pixmap to be used as icon.
+ * @param hints: WM_HINTS structure.
+ * @param icon_pixmap: Pixmap.
+ */
+void xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints,
+ xcb_pixmap_t icon_pixmap);
+
+/**
+ * @brief Set icon mask bitmap.
+ * @param hints: WM_HINTS structure.
+ * @param icon_mask: Pixmap.
+ */
+void xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask);
+
+/**
+ * @brief Set window identifier to be used as icon.
+ * @param hints: WM_HINTS structure.
+ * @param icon_window: Window X identifier.
+ */
+void xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints,
+ xcb_window_t icon_window);
+
+/**
+ * @brief Set identifier of related window group.
+ * @param hints: WM_HINTS structure.
+ * @param window_group: Window X identifier.
+ */
+void xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints,
+ xcb_window_t window_group);
+
+/**
+ * @brief Set urgency hints flag.
+ * @param hints: WM_HINTS structure.
+ */
+void xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints);
+
+/**
+ * @brief Deliver a SetProperty request to set WM_HINTS property value.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param hints: Hints value to set.
+ */
+void xcb_set_wm_hints_checked(xcb_connection_t *c, xcb_window_t window,
+ xcb_wm_hints_t *hints);
+
+/**
+ * @see xcb_set_wm_hints_checked()
+ */
+void xcb_set_wm_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_wm_hints_t *hints);
/**
* @brief Send request to get WM_HINTS property of a window.
commit f8a015611271db1ce6f04aae18846d1b30919a7b
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Sep 8 17:55:56 2008 +0200
[icccm] Avoid InternAtom request.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 8183868..e90cf72 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -660,33 +660,20 @@ xcb_get_wm_hints_reply(xcb_connection_t *c,
/* WM_PROTOCOLS */
void
-xcb_set_wm_protocols_checked (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t list_len,
- xcb_atom_t *list)
+xcb_set_wm_protocols_checked(xcb_connection_t *c, xcb_atom_t wm_protocols,
+ xcb_window_t window, uint32_t list_len,
+ xcb_atom_t *list)
{
- intern_atom_fast_cookie_t proto;
- xcb_atom_t WM_PROTOCOLS;
-
- proto = intern_atom_fast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS");
- WM_PROTOCOLS = intern_atom_fast_reply(c, proto, 0);
-
- xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
+ xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, wm_protocols,
+ ATOM, 32, list_len, list);
}
void
-xcb_set_wm_protocols (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t list_len,
- xcb_atom_t *list)
+xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols,
+ xcb_window_t window, uint32_t list_len, xcb_atom_t *list)
{
- intern_atom_fast_cookie_t proto;
- xcb_atom_t WM_PROTOCOLS;
-
- proto = intern_atom_fast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS");
- WM_PROTOCOLS = intern_atom_fast_reply(c, proto, 0);
-
- xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, wm_protocols, ATOM, 32,
+ list_len, list);
}
xcb_get_property_cookie_t
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 88eaa87..202e2b8 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -599,15 +599,24 @@ uint8_t xcb_get_wm_hints_reply(xcb_connection_t *c,
/* WM_PROTOCOLS */
-void xcb_set_wm_protocols_checked (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t list_len,
- xcb_atom_t *list);
+/**
+ * @brief Deliver a SetProperty request to set WM_PROTOCOLS property value.
+ * @param c: The connection to the X server.
+ * @param wm_protocols: The WM_PROTOCOLS atom.
+ * @param window: Window X identifier.
+ * @param list_len: Atom list len.
+ * @param list: Atom list.
+ */
+void xcb_set_wm_protocols_checked(xcb_connection_t *c, xcb_atom_t wm_protocols,
+ xcb_window_t window, uint32_t list_len,
+ xcb_atom_t *list);
-void xcb_set_wm_protocols (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t list_len,
- xcb_atom_t *list);
+/**
+ * @see xcb_set_wm_protocols_checked()
+ */
+void xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols,
+ xcb_window_t window, uint32_t list_len,
+ xcb_atom_t *list);
/**
* @brief WM_PROTOCOLS structure.
commit 0a17f077ce0e0db6842248f6395cdfad79e50c3c
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:10:49 2008 +0200
[icccm] Add functions to get WM_CLASS property.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 4bac4f8..8183868 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -236,6 +236,49 @@ xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
xcb_set_property_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
}
+/* WM_CLASS */
+
+xcb_get_property_cookie_t
+xcb_get_wm_class(xcb_connection_t *c, xcb_window_t window)
+{
+ return xcb_get_property(c, 0, window, WM_CLASS, STRING, 0L, 2048L);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_class_unchecked(xcb_connection_t *c, xcb_window_t window)
+{
+ return xcb_get_property_unchecked(c, 0, window, WM_CLASS, STRING, 0L, 2048L);
+}
+
+uint8_t
+xcb_get_wm_class_reply(xcb_connection_t *c, xcb_get_property_cookie_t cookie,
+ xcb_get_wm_class_reply_t *prop, xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+
+ if(!reply || reply->type != STRING || reply->format != 8)
+ {
+ free(reply);
+ return 0;
+ }
+
+ prop->_reply = reply;
+ prop->name = (char *) xcb_get_property_value(prop->_reply);
+
+ int name_len = strlen(prop->name);
+ if(name_len == xcb_get_property_value_length(prop->_reply))
+ name_len--;
+
+ prop->class = prop->name + name_len + 1;
+
+ return 1;
+}
+
+void xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop)
+{
+ free(prop->_reply);
+}
+
/* WM_TRANSIENT_FOR */
xcb_get_property_cookie_t
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index ac5df42..88eaa87 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -244,6 +244,61 @@ void xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
xcb_generic_property_handler_t handler,
void *data);
+/* WM_CLASS */
+
+/**
+ * @brief WM_CLASS hint structure
+ */
+typedef struct {
+ /** Instance name */
+ char *name;
+ /** Class of application */
+ char *class;
+ /** Store reply to avoid memory allocation, should normally not be
+ used directly */
+ xcb_get_property_reply_t *_reply;
+} xcb_get_wm_class_reply_t;
+
+/**
+ * @brief Deliver a GetProperty request to the X server for WM_CLASS.
+ * @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_class(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_class()
+ */
+xcb_get_property_cookie_t xcb_get_wm_class_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_CLASS property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param prop: WM_CLASS 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_class_unchecked() is used. Otherwise, it stores the
+ * error if any. prop structure members should be freed by
+ * xcb_get_wm_class_reply_wipe().
+ */
+uint8_t xcb_get_wm_class_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_wm_class_reply_t *prop,
+ xcb_generic_error_t **e);
+
+/**
+ * @brief Wipe prop structure members previously allocated by
+ * xcb_get_wm_class_reply().
+ * @param prop: prop structure whose members is going to be freed.
+ */
+void xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop);
+
/* WM_TRANSIENT_FOR */
/**
commit 36100f0efbc6f3ddc116a4dccb9a6a730a5c1bda
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:09:28 2008 +0200
[icccm] Add copyright notices.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index f340b62..4bac4f8 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -1,3 +1,32 @@
+/*
+ * Copyright (C) 2008 Arnaud Fontaine <arnau at debian.org>
+ * Copyright (C) 2007-2008 Vincent Torri <vtorri at univ-evry.fr>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the authors or
+ * their institutions shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization from the authors.
+ */
+
#include <stdlib.h>
#include <limits.h>
#include <string.h>
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index f27d9c8..ac5df42 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -1,6 +1,35 @@
#ifndef __XCB_ICCCM_H__
#define __XCB_ICCCM_H__
+/*
+ * Copyright (C) 2008 Arnaud Fontaine <arnau at debian.org>
+ * Copyright (C) 2007-2008 Vincent Torri <vtorri at univ-evry.fr>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the authors or
+ * their institutions shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization from the authors.
+ */
+
#include <xcb/xcb.h>
#include "xcb_property.h"
commit aca72dec53eec169fa3ee11de1a9161954b4368a
Author: Arnaud Fontaine <arnau at debian.org>
Date: Sun Aug 24 02:23:41 2008 +0200
[icccm] Fix namespace according to XCB code in general.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index e4c8027..f340b62 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -249,11 +249,11 @@ xcb_size_hints_set_position (xcb_size_hints_t *hints,
int32_t x,
int32_t y)
{
- hints->flags &= ~(XCB_SIZE_US_POSITION_HINT | XCB_SIZE_P_POSITION_HINT);
+ hints->flags &= ~(XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_P_POSITION);
if (user_specified)
- hints->flags |= XCB_SIZE_US_POSITION_HINT;
+ hints->flags |= XCB_SIZE_HINT_US_POSITION;
else
- hints->flags |= XCB_SIZE_P_POSITION_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_POSITION;
hints->x = x;
hints->y = y;
}
@@ -264,11 +264,11 @@ xcb_size_hints_set_size (xcb_size_hints_t *hints,
int32_t width,
int32_t height)
{
- hints->flags &= ~(XCB_SIZE_US_SIZE_HINT | XCB_SIZE_P_SIZE_HINT);
+ hints->flags &= ~(XCB_SIZE_HINT_US_SIZE | XCB_SIZE_HINT_P_SIZE);
if (user_specified)
- hints->flags |= XCB_SIZE_US_SIZE_HINT;
+ hints->flags |= XCB_SIZE_HINT_US_SIZE;
else
- hints->flags |= XCB_SIZE_P_SIZE_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_SIZE;
hints->width = width;
hints->height = height;
}
@@ -278,7 +278,7 @@ xcb_size_hints_set_min_size (xcb_size_hints_t *hints,
int32_t min_width,
int32_t min_height)
{
- hints->flags |= XCB_SIZE_P_MIN_SIZE_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_MIN_SIZE;
hints->min_width = min_width;
hints->min_height = min_height;
}
@@ -288,7 +288,7 @@ xcb_size_hints_set_max_size (xcb_size_hints_t *hints,
int32_t max_width,
int32_t max_height)
{
- hints->flags |= XCB_SIZE_P_MAX_SIZE_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_MAX_SIZE;
hints->max_width = max_width;
hints->max_height = max_height;
}
@@ -298,7 +298,7 @@ xcb_size_hints_set_resize_inc (xcb_size_hints_t *hints,
int32_t width_inc,
int32_t height_inc)
{
- hints->flags |= XCB_SIZE_P_RESIZE_INC_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_RESIZE_INC;
hints->width_inc = width_inc;
hints->height_inc = height_inc;
}
@@ -310,7 +310,7 @@ xcb_size_hints_set_aspect (xcb_size_hints_t *hints,
int32_t max_aspect_num,
int32_t max_aspect_den)
{
- hints->flags |= XCB_SIZE_P_ASPECT_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_ASPECT;
hints->min_aspect_num = min_aspect_num;
hints->min_aspect_den = min_aspect_den;
hints->max_aspect_num = max_aspect_num;
@@ -322,7 +322,7 @@ xcb_size_hints_set_base_size (xcb_size_hints_t *hints,
int32_t base_width,
int32_t base_height)
{
- hints->flags |= XCB_SIZE_BASE_SIZE_HINT;
+ hints->flags |= XCB_SIZE_HINT_BASE_SIZE;
hints->base_width = base_width;
hints->base_height = base_height;
}
@@ -331,7 +331,7 @@ void
xcb_size_hints_set_win_gravity (xcb_size_hints_t *hints,
uint8_t win_gravity)
{
- hints->flags |= XCB_SIZE_P_WIN_GRAVITY_HINT;
+ hints->flags |= XCB_SIZE_HINT_P_WIN_GRAVITY;
hints->win_gravity = win_gravity;
}
@@ -392,14 +392,14 @@ xcb_get_wm_size_hints_reply(xcb_connection_t *c, xcb_get_property_cookie_t cooki
memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (reply),
length * reply->format >> 3);
- hints->flags = (XCB_SIZE_US_POSITION_HINT | XCB_SIZE_US_SIZE_HINT |
- XCB_SIZE_P_POSITION_HINT | XCB_SIZE_P_SIZE_HINT |
- XCB_SIZE_P_MIN_SIZE_HINT | XCB_SIZE_P_MAX_SIZE_HINT |
- XCB_SIZE_P_RESIZE_INC_HINT | XCB_SIZE_P_ASPECT_HINT);
+ hints->flags = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
+ XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
+ XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
+ XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT);
/* NumPropSizeElements = 18 (ICCCM version 1) */
if(length >= 18)
- hints->flags |= (XCB_SIZE_BASE_SIZE_HINT | XCB_SIZE_P_WIN_GRAVITY_HINT);
+ hints->flags |= (XCB_SIZE_HINT_BASE_SIZE | XCB_SIZE_HINT_P_WIN_GRAVITY);
else
{
hints->base_width = 0;
@@ -455,75 +455,75 @@ xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
uint32_t
xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints)
{
- return (hints->flags & XCB_WM_X_URGENCY_HINT);
+ return (hints->flags & XCB_WM_HINT_X_URGENCY);
}
void
xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input)
{
hints->input = input;
- hints->flags |= XCB_WM_INPUT_HINT;
+ hints->flags |= XCB_WM_HINT_INPUT;
}
void
xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_ICONIC_STATE;
- hints->flags |= XCB_WM_STATE_HINT;
+ hints->initial_state = XCB_WM_STATE_ICONIC;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_normal(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_NORMAL_STATE;
- hints->flags |= XCB_WM_STATE_HINT;
+ hints->initial_state = XCB_WM_STATE_NORMAL;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints)
{
- hints->initial_state = XCB_WM_WITHDRAWN_STATE;
- hints->flags |= XCB_WM_STATE_HINT;
+ hints->initial_state = XCB_WM_STATE_WITHDRAWN;
+ hints->flags |= XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_none(xcb_wm_hints_t *hints)
{
- hints->flags &= ~XCB_WM_STATE_HINT;
+ hints->flags &= ~XCB_WM_HINT_STATE;
}
void
xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints, xcb_pixmap_t icon_pixmap)
{
hints->icon_pixmap = icon_pixmap;
- hints->flags |= XCB_WM_ICON_PIXMAP_HINT;
+ hints->flags |= XCB_WM_HINT_ICON_PIXMAP;
}
void
xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask)
{
hints->icon_mask = icon_mask;
- hints->flags |= XCB_WM_ICON_MASK_HINT;
+ hints->flags |= XCB_WM_HINT_ICON_MASK;
}
void
xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints, xcb_window_t icon_window)
{
hints->icon_window = icon_window;
- hints->flags |= XCB_WM_ICON_WINDOW_HINT;
+ hints->flags |= XCB_WM_HINT_ICON_WINDOW;
}
void
xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints, xcb_window_t window_group)
{
hints->window_group = window_group;
- hints->flags |= XCB_WM_WINDOW_GROUP_HINT;
+ hints->flags |= XCB_WM_HINT_WINDOW_GROUP;
}
void
xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints)
{
- hints->flags |= XCB_WM_X_URGENCY_HINT;
+ hints->flags |= XCB_WM_HINT_X_URGENCY;
}
void
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 75a7fc8..f27d9c8 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -252,16 +252,16 @@ uint8_t xcb_get_wm_transient_for_reply(xcb_connection_t *c,
/* WM_SIZE_HINTS */
typedef enum {
- XCB_SIZE_US_POSITION_HINT = 1 << 0,
- XCB_SIZE_US_SIZE_HINT = 1 << 1,
- XCB_SIZE_P_POSITION_HINT = 1 << 2,
- XCB_SIZE_P_SIZE_HINT = 1 << 3,
- XCB_SIZE_P_MIN_SIZE_HINT = 1 << 4,
- XCB_SIZE_P_MAX_SIZE_HINT = 1 << 5,
- XCB_SIZE_P_RESIZE_INC_HINT = 1 << 6,
- XCB_SIZE_P_ASPECT_HINT = 1 << 7,
- XCB_SIZE_BASE_SIZE_HINT = 1 << 8,
- XCB_SIZE_P_WIN_GRAVITY_HINT = 1 << 9
+ XCB_SIZE_HINT_US_POSITION = 1 << 0,
+ XCB_SIZE_HINT_US_SIZE = 1 << 1,
+ XCB_SIZE_HINT_P_POSITION = 1 << 2,
+ XCB_SIZE_HINT_P_SIZE = 1 << 3,
+ XCB_SIZE_HINT_P_MIN_SIZE = 1 << 4,
+ XCB_SIZE_HINT_P_MAX_SIZE = 1 << 5,
+ XCB_SIZE_HINT_P_RESIZE_INC = 1 << 6,
+ XCB_SIZE_HINT_P_ASPECT = 1 << 7,
+ XCB_SIZE_HINT_BASE_SIZE = 1 << 8,
+ XCB_SIZE_HINT_P_WIN_GRAVITY = 1 << 9
} xcb_size_hints_flags_t;
/**
@@ -440,25 +440,25 @@ typedef struct {
#define XCB_NUM_WM_HINTS_ELEMENTS 9 /* number of elements in this structure */
typedef enum {
- XCB_WM_WITHDRAWN_STATE = 0,
- XCB_WM_NORMAL_STATE = 1,
- XCB_WM_ICONIC_STATE = 3
+ XCB_WM_STATE_WITHDRAWN = 0,
+ XCB_WM_STATE_NORMAL = 1,
+ XCB_WM_STATE_ICONIC = 3
} xcb_wm_state_t;
typedef enum {
- XCB_WM_INPUT_HINT = (1L << 0),
- XCB_WM_STATE_HINT = (1L << 1),
- XCB_WM_ICON_PIXMAP_HINT = (1L << 2),
- XCB_WM_ICON_WINDOW_HINT = (1L << 3),
- XCB_WM_ICON_POSITION_HINT = (1L << 4),
- XCB_WM_ICON_MASK_HINT = (1L << 5),
- XCB_WM_WINDOW_GROUP_HINT = (1L << 6),
- XCB_WM_X_URGENCY_HINT = (1L << 8)
+ XCB_WM_HINT_INPUT = (1L << 0),
+ XCB_WM_HINT_STATE = (1L << 1),
+ XCB_WM_HINT_ICON_PIXMAP = (1L << 2),
+ XCB_WM_HINT_ICON_WINDOW = (1L << 3),
+ XCB_WM_HINT_ICON_POSITION = (1L << 4),
+ XCB_WM_HINT_ICON_MASK = (1L << 5),
+ XCB_WM_HINT_WINDOW_GROUP = (1L << 6),
+ XCB_WM_HINT_X_URGENCY = (1L << 8)
} xcb_wm_t;
-#define XCB_WM_ALL_HINTS (XCB_WM_INPUT_HINT | XCB_WM_STATE_HINT | XCB_WM_ICON_PIXMAP_HINT | \
- XCB_WM_ICON_WINDOW_HINT | XCB_WM_ICON_POSITION_HINT | XCB_WM_ICON_MASK_HINT | \
- XCB_WM_WINDOW_GROUP_HINT)
+#define XCB_WM_ALL_HINTS (XCB_WM_HINT_INPUT | XCB_WM_HINT_STATE | XCB_WM_HINT_ICON_PIXMAP | \
+ XCB_WM_HINT_ICON_WINDOW | XCB_WM_HINT_ICON_POSITION | XCB_WM_HINT_ICON_MASK | \
+ XCB_WM_HINT_WINDOW_GROUP)
uint32_t xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints);
commit 20fd8aed33fa544806175180ce054ca8c4868113
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:08:32 2008 +0200
[icccm] Make xcb_get_wm_protocols() asynchronous and document the
code.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index f2aa775..e4c8027 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -617,44 +617,46 @@ xcb_set_wm_protocols (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
}
-int
-xcb_get_wm_protocols (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t *list_len,
- xcb_atom_t **list)
-{
- xcb_get_property_cookie_t cookie;
- xcb_get_property_reply_t *rep;
- xcb_atom_t property;
-
- property = intern_atom_fast_reply(c,
- intern_atom_fast(c,
- 0,
- strlen("WM_PROTOCOLS"),
- "WM_PROTOCOLS"),
- NULL);
- cookie = xcb_get_property(c, 0, window,
- property, ATOM, 0, 1000000L);
- rep = xcb_get_property_reply(c, cookie, 0);
- if (!rep)
- return 0;
- if ((rep->type == ATOM) ||
- (rep->format == 32))
- {
- int length;
-
- length = xcb_get_property_value_length(rep);
- *list_len = length;
- *list = (xcb_atom_t *)malloc(sizeof(xcb_atom_t) * length);
- if (!(*list))
- {
- free(rep);
- return 0;
- }
- memcpy(*list, xcb_get_property_value(rep), length * rep->format >> 3);
- free(rep);
- return 1;
- }
- free(rep);
- return 0;
+xcb_get_property_cookie_t
+xcb_get_wm_protocols(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t wm_protocol_atom)
+{
+ return xcb_get_property(c, 0, window, wm_protocol_atom, ATOM, 0, UINT_MAX);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_protocols_unchecked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t wm_protocol_atom)
+{
+ return xcb_get_property_unchecked(c, 0, window, wm_protocol_atom, ATOM, 0,
+ UINT_MAX);
+}
+
+uint8_t
+xcb_get_wm_protocols_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_wm_protocols_reply_t *protocols,
+ xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+
+ if(!reply || reply->type != ATOM || reply->format != 32)
+ {
+ free(reply);
+ return 0;
+ }
+
+ protocols->_reply = reply;
+ protocols->atoms_len = xcb_get_property_value_length(protocols->_reply);
+ protocols->atoms = (xcb_atom_t *) xcb_get_property_value(protocols->_reply);
+
+ return 1;
+}
+
+void
+xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols)
+{
+ free(protocols->_reply);
}
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index efee687..75a7fc8 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -525,10 +525,60 @@ void xcb_set_wm_protocols (xcb_connection_t *c,
uint32_t list_len,
xcb_atom_t *list);
-int xcb_get_wm_protocols (xcb_connection_t *c,
- xcb_window_t window,
- uint32_t *list_len,
- xcb_atom_t **list);
+/**
+ * @brief WM_PROTOCOLS structure.
+ */
+typedef struct {
+ /** Length of the atoms list */
+ uint32_t atoms_len;
+ /** Atoms list */
+ xcb_atom_t *atoms;
+ /** Store reply to avoid memory allocation, should normally not be
+ used directly */
+ xcb_get_property_reply_t *_reply;
+} xcb_get_wm_protocols_reply_t;
+
+/**
+ * @brief Send request to get WM_PROTOCOLS 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_protocols(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t wm_protocol_atom);
+
+/**
+ * @see xcb_get_wm_protocols()
+ */
+xcb_get_property_cookie_t xcb_get_wm_protocols_unchecked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t wm_protocol_atom);
+
+/**
+ * @brief Fill the given structure with the WM_PROTOCOLS property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param protocols: WM_PROTOCOLS 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_protocols_unchecked() is used. Otherwise, it stores the
+ * error if any. protocols structure members should be freed by
+ * xcb_get_wm_protocols_reply_wipe().
+ */
+uint8_t xcb_get_wm_protocols_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_wm_protocols_reply_t *protocols,
+ xcb_generic_error_t **e);
+
+/**
+ * @brief Wipe protocols structure members previously allocated by
+ * xcb_get_wm_protocols_reply().
+ * @param protocols: protocols structure whose members is going to be freed.
+ */
+void xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols);
#ifdef __cplusplus
}
commit e7d04965aa084e590636455d8ccb238c7ef56113
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:07:12 2008 +0200
[icccm] Make xcb_get_wm_hints() asynchronous, remove useless functions
and document the code.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index e92eb33..f2aa775 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -452,87 +452,12 @@ xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
/* WM_HINTS */
-struct xcb_wm_hints_t {
- int32_t flags; /* marks which fields in this structure are defined */
- uint8_t input; /* does this application rely on the window manager
- to get keyboard input? */
- int32_t initial_state; /* see below */
- xcb_pixmap_t icon_pixmap; /* pixmap to be used as icon */
- xcb_window_t icon_window; /* window to be used as icon */
- int32_t icon_x; /* initial position of icon */
- int32_t icon_y;
- xcb_pixmap_t icon_mask; /* icon mask bitmap */
- xcb_window_t window_group; /* id of related window group */
- /* this structure may be extended in the future */
-};
-
-xcb_wm_hints_t *
-xcb_alloc_wm_hints()
-{
- return calloc(1, sizeof(xcb_wm_hints_t));
-}
-
-void
-xcb_free_wm_hints(xcb_wm_hints_t *hints)
-{
- free(hints);
-}
-
-uint8_t
-xcb_wm_hints_get_input(xcb_wm_hints_t *hints)
-{
- return hints->input;
-}
-
-xcb_pixmap_t
-xcb_wm_hints_get_icon_pixmap(xcb_wm_hints_t *hints)
-{
- return hints->icon_pixmap;
-}
-
-xcb_pixmap_t
-xcb_wm_hints_get_icon_mask(xcb_wm_hints_t *hints)
-{
- return hints->icon_mask;
-}
-
-xcb_window_t
-xcb_wm_hints_get_icon_window(xcb_wm_hints_t *hints)
-{
- return hints->icon_window;
-}
-
-xcb_window_t
-xcb_wm_hints_get_window_group(xcb_wm_hints_t *hints)
-{
- return hints->window_group;
-}
-
uint32_t
xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints)
{
return (hints->flags & XCB_WM_X_URGENCY_HINT);
}
-uint32_t
-xcb_wm_hints_get_flags(xcb_wm_hints_t *hints)
-{
- return hints->flags;
-}
-
-void
-xcb_wm_hints_set_flags(xcb_wm_hints_t *hints,
- uint32_t flags)
-{
- hints->flags = flags;
-}
-
-uint32_t
-xcb_wm_hints_get_initial_state(xcb_wm_hints_t *hints)
-{
- return hints->initial_state;
-}
-
void
xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input)
{
@@ -617,40 +542,47 @@ xcb_set_wm_hints (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32, sizeof(*hints) / 4, hints);
}
-xcb_wm_hints_t *
-xcb_get_wm_hints (xcb_connection_t *c,
- xcb_window_t window)
+xcb_get_property_cookie_t xcb_get_wm_hints(xcb_connection_t *c,
+ xcb_window_t window)
{
- xcb_get_property_cookie_t cookie;
- xcb_get_property_reply_t *rep = NULL;
- xcb_wm_hints_t *hints = NULL;
- long length;
+ return xcb_get_property(c, 0, window, WM_HINTS, WM_HINTS, 0L,
+ XCB_NUM_WM_HINTS_ELEMENTS);
+}
- cookie = xcb_get_property (c, 0, window,
- WM_HINTS, WM_HINTS,
- 0L, XCB_NUM_WM_HINTS_ELEMENTS);
- rep = xcb_get_property_reply (c, cookie, 0);
- if (!rep)
- return NULL;
-
- length = xcb_get_property_value_length (rep);
- if ((rep->type != WM_HINTS) ||
- (length < (XCB_NUM_WM_HINTS_ELEMENTS - 1)) ||
- (rep->format != 32))
- goto bailout;
-
- hints = xcb_alloc_wm_hints();
- if (!hints)
- goto bailout;
-
- memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (rep),
- length * rep->format >> 3);
- if (length < XCB_NUM_WM_HINTS_ELEMENTS)
- hints->window_group = XCB_NONE;
-
- bailout:
- free(rep);
- return hints;
+xcb_get_property_cookie_t xcb_get_wm_hints_unchecked(xcb_connection_t *c,
+ xcb_window_t window)
+{
+ return xcb_get_property_unchecked(c, 0, window, WM_HINTS, WM_HINTS, 0L,
+ XCB_NUM_WM_HINTS_ELEMENTS);
+}
+
+uint8_t
+xcb_get_wm_hints_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_wm_hints_t *hints,
+ xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+ if(!reply)
+ return 0;
+
+ int length = xcb_get_property_value_length(reply);
+
+ if ((reply->type != WM_HINTS) ||
+ (length < (XCB_NUM_WM_HINTS_ELEMENTS - 1)) ||
+ (reply->format != 32))
+ {
+ free(reply);
+ return 0;
+ }
+
+ memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value(reply),
+ length * reply->format >> 3);
+
+ if(length < XCB_NUM_WM_HINTS_ELEMENTS)
+ hints->window_group = XCB_NONE;
+
+ return 1;
}
/* WM_PROTOCOLS */
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index eb4f670..efee687 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -414,7 +414,29 @@ uint8_t xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
/* WM_HINTS */
-typedef struct xcb_wm_hints_t xcb_wm_hints_t;
+/**
+ * @brief WM hints structure (may be extended in the future).
+ */
+typedef struct {
+ /** Marks which fields in this structure are defined */
+ int32_t flags;
+ /** Does this application rely on the window manager to get keyboard
+ input? */
+ uint8_t input;
+ /** See below */
+ int32_t initial_state;
+ /** Pixmap to be used as icon */
+ xcb_pixmap_t icon_pixmap;
+ /** Window to be used as icon */
+ xcb_window_t icon_window;
+ /** Initial position of icon */
+ int32_t icon_x, icon_y;
+ /** Icon mask bitmap */
+ xcb_pixmap_t icon_mask;
+ /* Identifier of related window group */
+ xcb_window_t window_group;
+} xcb_wm_hints_t;
+
#define XCB_NUM_WM_HINTS_ELEMENTS 9 /* number of elements in this structure */
typedef enum {
@@ -438,19 +460,7 @@ typedef enum {
XCB_WM_ICON_WINDOW_HINT | XCB_WM_ICON_POSITION_HINT | XCB_WM_ICON_MASK_HINT | \
XCB_WM_WINDOW_GROUP_HINT)
-xcb_wm_hints_t *xcb_alloc_wm_hints();
-void xcb_free_wm_hints (xcb_wm_hints_t *hints);
-
-uint8_t xcb_wm_hints_get_input (xcb_wm_hints_t *hints);
-xcb_pixmap_t xcb_wm_hints_get_icon_pixmap (xcb_wm_hints_t *hints);
-xcb_pixmap_t xcb_wm_hints_get_icon_mask (xcb_wm_hints_t *hints);
-xcb_window_t xcb_wm_hints_get_icon_window (xcb_wm_hints_t *hints);
-xcb_window_t xcb_wm_hints_get_window_group (xcb_wm_hints_t *hints);
-uint32_t xcb_wm_hints_get_urgency (xcb_wm_hints_t *hints);
-
-uint32_t xcb_wm_hints_get_flags(xcb_wm_hints_t *hints);
-void xcb_wm_hints_set_flags(xcb_wm_hints_t *hints, uint32_t flags);
-uint32_t xcb_wm_hints_get_initial_state(xcb_wm_hints_t *hints);
+uint32_t xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints);
void xcb_wm_hints_set_input (xcb_wm_hints_t *hints, uint8_t input);
void xcb_wm_hints_set_iconic (xcb_wm_hints_t *hints);
@@ -471,8 +481,37 @@ void xcb_set_wm_hints (xcb_connection_t *c,
xcb_window_t window,
xcb_wm_hints_t *hints);
-xcb_wm_hints_t *xcb_get_wm_hints (xcb_connection_t *c,
- xcb_window_t window);
+/**
+ * @brief Send request to get WM_HINTS property of a 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_hints(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_hints()
+ */
+xcb_get_property_cookie_t xcb_get_wm_hints_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_HINTS property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param hints: WM_HINTS 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_hints_unchecked() is used. Otherwise, it stores the
+ * error if any. The returned pointer should be freed.
+ */
+uint8_t xcb_get_wm_hints_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_wm_hints_t *hints,
+ xcb_generic_error_t **e);
/* WM_PROTOCOLS */
commit fc937690dba539905b64c85d4c096ff8b8155649
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:06:02 2008 +0200
[icccm] Make xcb_get_wm_size_hints() and xcb_get_wm_normal_hints()
asynchronous, remove useless functions and document the code.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 695b69e..e92eb33 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -243,121 +243,6 @@ xcb_get_wm_transient_for_reply(xcb_connection_t *c,
/* WM_SIZE_HINTS */
-struct xcb_size_hints_t {
- uint32_t flags;
- int32_t x, y, width, height;
- int32_t min_width, min_height;
- int32_t max_width, max_height;
- int32_t width_inc, height_inc;
- int32_t min_aspect_num, min_aspect_den;
- int32_t max_aspect_num, max_aspect_den;
- int32_t base_width, base_height;
- uint32_t win_gravity;
-};
-
-xcb_size_hints_t *
-xcb_alloc_size_hints()
-{
- return calloc(1, sizeof(xcb_size_hints_t));
-}
-
-void
-xcb_free_size_hints(xcb_size_hints_t *hints)
-{
- free(hints);
-}
-
-void
-xcb_size_hints_get_position (xcb_size_hints_t *hints,
- int32_t *x,
- int32_t *y)
-{
- *x = hints->x;
- *y = hints->y;
-}
-
-void
-xcb_size_hints_get_size (xcb_size_hints_t *hints,
- int32_t *width,
- int32_t *height)
-{
- *width = hints->width;
- *height = hints->height;
-}
-
-void
-xcb_size_hints_get_min_size (xcb_size_hints_t *hints,
- int32_t *min_width,
- int32_t *min_height)
-{
- *min_width = hints->min_width;
- *min_height = hints->min_height;
-}
-
-void
-xcb_size_hints_get_max_size (xcb_size_hints_t *hints,
- int32_t *max_width,
- int32_t *max_height)
-{
- *max_width = hints->max_width;
- *max_height = hints->max_height;
-}
-
-void
-xcb_size_hints_get_increase (xcb_size_hints_t *hints,
- int32_t *width_inc,
- int32_t *height_inc)
-{
- *width_inc = hints->width_inc;
- *height_inc = hints->height_inc;
-}
-
-void
-xcb_size_hints_get_min_aspect (xcb_size_hints_t *hints,
- int32_t *min_aspect_num,
- int32_t *min_aspect_den)
-{
- *min_aspect_num = hints->min_aspect_num;
- *min_aspect_den = hints->min_aspect_den;
-}
-
-void
-xcb_size_hints_get_max_aspect (xcb_size_hints_t *hints,
- int32_t *max_aspect_num,
- int32_t *max_aspect_den)
-{
- *max_aspect_num = hints->max_aspect_num;
- *max_aspect_den = hints->max_aspect_den;
-}
-
-void
-xcb_size_hints_get_base_size (xcb_size_hints_t *hints,
- int32_t *base_width,
- int32_t *base_height)
-{
- *base_width = hints->base_width;
- *base_height = hints->base_height;
-}
-
-uint32_t
-xcb_size_hints_get_win_gravity (xcb_size_hints_t *hints)
-{
- return hints->win_gravity;
-}
-
-uint32_t
-xcb_size_hints_get_flags (xcb_size_hints_t *hints)
-{
- return hints->flags;
-}
-
-void
-xcb_size_hints_set_flags (xcb_size_hints_t *hints,
- uint32_t flags)
-{
- hints->flags = flags;
-}
-
void
xcb_size_hints_set_position (xcb_size_hints_t *hints,
int user_specified,
@@ -468,59 +353,62 @@ xcb_set_wm_size_hints (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
}
-xcb_size_hints_t *
-xcb_get_wm_size_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- long *supplied)
+xcb_get_property_cookie_t
+xcb_get_wm_size_hints(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property)
{
- xcb_get_property_cookie_t cookie;
- xcb_get_property_reply_t *rep;
- xcb_size_hints_t *hints = NULL;
- long length;
+ /* NumPropSizeElements = 18 (ICCCM version 1). */
+ return xcb_get_property(c, 0, window, property, WM_SIZE_HINTS, 0L, 18);
+}
- cookie = xcb_get_property (c, 0, window,
- property, WM_SIZE_HINTS,
- 0L, 18); /* NumPropSizeElements = 18 (ICCCM version 1) */
- rep = xcb_get_property_reply (c, cookie, 0);
- if (!rep)
- return NULL;
+xcb_get_property_cookie_t
+xcb_get_wm_size_hints_unchecked(xcb_connection_t *c, xcb_window_t window,
+ xcb_atom_t property)
+{
+ return xcb_get_property_unchecked(c, 0, window, property, WM_SIZE_HINTS,
+ 0L, 18);
+}
- length = xcb_get_property_value_length (rep);
- if ((rep->type == WM_SIZE_HINTS) &&
- ((rep->format == 8) ||
- (rep->format == 16) ||
- (rep->format == 32)) &&
- (length >= 15)) /* OldNumPropSizeElements = 15 (pre-ICCCM) */
- {
- hints = xcb_alloc_size_hints();
- if (!hints)
- {
- free (rep);
- return NULL;
- }
+uint8_t
+xcb_get_wm_size_hints_reply(xcb_connection_t *c, xcb_get_property_cookie_t cookie,
+ xcb_size_hints_t *hints, xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = reply = xcb_get_property_reply(c, cookie, e);
+ if(!reply)
+ return 0;
- memcpy (hints, (xcb_size_hints_t *) xcb_get_property_value (rep),
- length * rep->format >> 3);
+ int length = xcb_get_property_value_length(reply);
- *supplied = (XCB_SIZE_US_POSITION_HINT | XCB_SIZE_US_SIZE_HINT |
- XCB_SIZE_P_POSITION_HINT | XCB_SIZE_P_SIZE_HINT |
- XCB_SIZE_P_MIN_SIZE_HINT | XCB_SIZE_P_MAX_SIZE_HINT |
- XCB_SIZE_P_RESIZE_INC_HINT | XCB_SIZE_P_ASPECT_HINT);
- if (length >= 18) /* NumPropSizeElements = 18 (ICCCM version 1) */
- *supplied |= (XCB_SIZE_BASE_SIZE_HINT | XCB_SIZE_P_WIN_GRAVITY_HINT);
- else
- {
- hints->base_width = 0;
- hints->base_height = 0;
- hints->win_gravity = 0;
- }
- hints->flags &= (*supplied); /* get rid of unwanted bits */
- }
+ if (!(reply->type == WM_SIZE_HINTS &&
+ (reply->format == 8 || reply->format == 16 ||
+ reply->format == 32) &&
+ /* OldNumPropSizeElements = 15 (pre-ICCCM) */
+ length >= 15))
+ {
+ free(reply);
+ return 0;
+ }
- free (rep);
+ memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (reply),
+ length * reply->format >> 3);
- return hints;
+ hints->flags = (XCB_SIZE_US_POSITION_HINT | XCB_SIZE_US_SIZE_HINT |
+ XCB_SIZE_P_POSITION_HINT | XCB_SIZE_P_SIZE_HINT |
+ XCB_SIZE_P_MIN_SIZE_HINT | XCB_SIZE_P_MAX_SIZE_HINT |
+ XCB_SIZE_P_RESIZE_INC_HINT | XCB_SIZE_P_ASPECT_HINT);
+
+ /* NumPropSizeElements = 18 (ICCCM version 1) */
+ if(length >= 18)
+ hints->flags |= (XCB_SIZE_BASE_SIZE_HINT | XCB_SIZE_P_WIN_GRAVITY_HINT);
+ else
+ {
+ hints->base_width = 0;
+ hints->base_height = 0;
+ hints->win_gravity = 0;
+ }
+
+ free(reply);
+ return 1;
}
/* WM_NORMAL_HINTS */
@@ -541,12 +429,25 @@ xcb_set_wm_normal_hints (xcb_connection_t *c,
xcb_set_wm_size_hints(c, window, WM_NORMAL_HINTS, hints);
}
-xcb_size_hints_t *
-xcb_get_wm_normal_hints (xcb_connection_t *c,
- xcb_window_t window,
- long *supplied)
+xcb_get_property_cookie_t
+xcb_get_wm_normal_hints(xcb_connection_t *c, xcb_window_t window)
+{
+ return xcb_get_wm_size_hints(c, window, WM_NORMAL_HINTS);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_normal_hints_unchecked(xcb_connection_t *c, xcb_window_t window)
+{
+ return xcb_get_wm_size_hints_unchecked(c, window, WM_NORMAL_HINTS);
+}
+
+uint8_t
+xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_size_hints_t *hints,
+ xcb_generic_error_t **e)
{
- return (xcb_get_wm_size_hints (c, window, WM_NORMAL_HINTS, supplied));
+ return xcb_get_wm_size_hints_reply(c, cookie, hints, e);
}
/* WM_HINTS */
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 5b50fae..eb4f670 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -264,42 +264,31 @@ typedef enum {
XCB_SIZE_P_WIN_GRAVITY_HINT = 1 << 9
} xcb_size_hints_flags_t;
-typedef struct xcb_size_hints_t xcb_size_hints_t;
-
-xcb_size_hints_t *xcb_alloc_size_hints ();
-
-void xcb_free_size_hints (xcb_size_hints_t *hints);
-
-void xcb_size_hints_get_position (xcb_size_hints_t *hints,
- int32_t *x,
- int32_t *y);
-void xcb_size_hints_get_size (xcb_size_hints_t *hints,
- int32_t *width,
- int32_t *height);
-void xcb_size_hints_get_min_size (xcb_size_hints_t *hints,
- int32_t *min_width,
- int32_t *min_height);
-void xcb_size_hints_get_max_size (xcb_size_hints_t *hints,
- int32_t *max_width,
- int32_t *max_height);
-void xcb_size_hints_get_increase (xcb_size_hints_t *hints,
- int32_t *width_inc,
- int32_t *height_inc);
-void xcb_size_hints_get_min_aspect (xcb_size_hints_t *hints,
- int32_t *min_aspect_num,
- int32_t *min_aspect_den);
-void xcb_size_hints_get_max_aspect (xcb_size_hints_t *hints,
- int32_t *max_aspect_num,
- int32_t *max_aspect_den);
-void xcb_size_hints_get_base_size (xcb_size_hints_t *hints,
- int32_t *base_width,
- int32_t *base_height);
-uint32_t xcb_size_hints_get_win_gravity (xcb_size_hints_t *hints);
-
-uint32_t xcb_size_hints_get_flags (xcb_size_hints_t *hints);
-
-void xcb_size_hints_set_flags (xcb_size_hints_t *hints,
- uint32_t flags);
+/**
+ * @brief Size hints structure.
+ */
+typedef struct {
+ /** User specified flags */
+ uint32_t flags;
+ /** User-specified position */
+ int32_t x, y;
+ /** User-specified size */
+ int32_t width, height;
+ /** Program-specified minimum size */
+ int32_t min_width, min_height;
+ /** Program-specified maximum size */
+ int32_t max_width, max_height;
+ /** Program-specified resize increments */
+ int32_t width_inc, height_inc;
+ /** Program-specified minimum aspect ratios */
+ int32_t min_aspect_num, min_aspect_den;
+ /** Program-specified maximum aspect ratios */
+ int32_t max_aspect_num, max_aspect_den;
+ /** Program-specified base size */
+ int32_t base_width, base_height;
+ /** Program-specified window gravity */
+ uint32_t win_gravity;
+} xcb_size_hints_t;
void xcb_size_hints_set_position (xcb_size_hints_t *hints,
int user_specified,
@@ -346,10 +335,40 @@ void xcb_set_wm_size_hints (xcb_connection_t *c,
xcb_atom_t property,
xcb_size_hints_t *hints);
-xcb_size_hints_t *xcb_get_wm_size_hints (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- long *supplied);
+/**
+ * @brief Send request to get size hints structure for the named property.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param property: Specify the property name.
+ * @return The request cookie.
+ */
+xcb_get_property_cookie_t xcb_get_wm_size_hints(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property);
+
+/**
+ * @see xcb_get_wm_size_hints()
+ */
+xcb_get_property_cookie_t xcb_get_wm_size_hints_unchecked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property);
+
+/**
+ * @brief Fill given structure with the size hints of the named property.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param hints: Size hints structure.
+ * @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_size_hints_unchecked() is used. Otherwise, it stores
+ * the error if any. The returned pointer should be freed.
+ */
+uint8_t xcb_get_wm_size_hints_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_size_hints_t *hints,
+ xcb_generic_error_t **e);
/* WM_NORMAL_HINTS */
@@ -361,9 +380,37 @@ void xcb_set_wm_normal_hints (xcb_connection_t *c,
xcb_window_t window,
xcb_size_hints_t *hints);
-xcb_size_hints_t *xcb_get_wm_normal_hints (xcb_connection_t *c,
- xcb_window_t window,
- long *supplied);
+/**
+ * @brief Send request to get WM_NORMAL_HINTS property of a 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_normal_hints(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_normal_hints()
+ */
+xcb_get_property_cookie_t xcb_get_wm_normal_hints_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_NORMAL_HINTS property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param hints: WM_NORMAL_HINTS 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_normal_hints_unchecked() is used. Otherwise, it stores
+ * the error if any. The returned pointer should be freed.
+ */
+uint8_t xcb_get_wm_normal_hints_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_size_hints_t *hints,
+ xcb_generic_error_t **e);
/* WM_HINTS */
commit f716a0b910ab0c6dd3e4ff4d844dde5345be787e
Author: Arnaud Fontaine <arnau at debian.org>
Date: Mon Aug 25 00:00:54 2008 +0200
[icccm] Make xcb_get_wm_transient_for() asynchronous and document the code.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 749ef70..695b69e 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -208,31 +208,37 @@ xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
}
/* 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
+xcb_get_wm_transient_for(xcb_connection_t *c, xcb_window_t window)
{
- xcb_get_property_cookie_t prop_q;
- xcb_get_property_reply_t *prop_r;
+ return xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1);
+}
- prop_q = xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1);
- prop_r = xcb_get_property_reply(c, prop_q, NULL);
+xcb_get_property_cookie_t
+xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, xcb_window_t window)
+{
+ return xcb_get_property_unchecked(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1);
+}
- if(!prop_r)
- return 0;
+uint8_t
+xcb_get_wm_transient_for_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_window_t *prop,
+ xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
- if(prop_r->type != WINDOW || prop_r->format != 32 || !prop_r->length)
- {
- *prop_win = XCB_NONE;
- free(prop_r);
- return 0;
- }
+ if(!reply || reply->type != WINDOW || reply->format != 32 || !reply->length)
+ {
+ free(reply);
+ return 0;
+ }
- *prop_win = *((xcb_window_t *) xcb_get_property_value(prop_r));
- free(prop_r);
+ *prop = *((xcb_window_t *) xcb_get_property_value(reply));
- return 1;
+ free(reply);
+ return 1;
}
/* WM_SIZE_HINTS */
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 108c9bb..5b50fae 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -216,9 +216,38 @@ void xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
void *data);
/* WM_TRANSIENT_FOR */
-int xcb_get_wm_transient_for (xcb_connection_t *c,
- xcb_window_t window,
- xcb_window_t *prop_win);
+
+/**
+ * @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.
+ * @return The request cookie.
+ */
+xcb_get_property_cookie_t xcb_get_wm_transient_for(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_transient_for_unchecked()
+ */
+xcb_get_property_cookie_t xcb_get_wm_transient_for_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param prop: WM_TRANSIENT_FOR 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_transient_for_unchecked() is used. Otherwise, it stores
+ * the error if any.
+ */
+uint8_t xcb_get_wm_transient_for_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_window_t *prop,
+ xcb_generic_error_t **e);
/* WM_SIZE_HINTS */
commit 2d15ce5ff16b40388d0fef65f12c70d2cfb264d3
Author: Arnaud Fontaine <arnau at debian.org>
Date: Sun Aug 24 23:56:26 2008 +0200
[icccm] Make xcb_get_text_property() and functions relying on it
asynchronous, and also document the code.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 1a5e864..749ef70 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -1,39 +1,48 @@
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
+
#include "xcb_icccm.h"
#include "xcb_atom.h"
-
-int
+xcb_get_property_cookie_t
xcb_get_text_property(xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name)
+ xcb_window_t window,
+ xcb_atom_t property)
{
- xcb_get_property_cookie_t cookie;
- xcb_get_property_reply_t *reply;
-
- cookie = xcb_get_any_property(c, 0, window, property, 128);
- reply = xcb_get_property_reply(c, cookie, 0);
- if(!reply)
- return 0;
- *format = reply->format;
- *encoding = reply->type;
- *name_len = xcb_get_property_value_length(reply) * *format / 8;
- if(reply->bytes_after)
- {
- cookie = xcb_get_property(c, 0, window, property, reply->type, 0, *name_len);
- free(reply);
- reply = xcb_get_property_reply(c, cookie, 0);
- if(!reply)
- return 0;
- }
- memmove(reply, xcb_get_property_value(reply), *name_len);
- *name = (char *) reply;
- return 1;
+ return xcb_get_any_property(c, 0, window, property, UINT_MAX);
+}
+
+xcb_get_property_cookie_t
+xcb_get_text_property_unchecked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property)
+{
+ return xcb_get_any_property_unchecked(c, 0, window, property, UINT_MAX);
+}
+
+uint8_t
+xcb_get_text_property_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e)
+{
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+ if(!reply)
+ return 0;
+
+ prop->_reply = reply;
+ prop->encoding = prop->_reply->type;
+ prop->format = prop->_reply->format;
+ prop->name_len = xcb_get_property_value_length(prop->_reply) * prop->format >> 3;
+ prop->name = xcb_get_property_value(prop->_reply);
+
+ return 1;
+}
+
+void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop)
+{
+ free(prop->_reply);
}
/* WM_NAME */
@@ -58,15 +67,27 @@ xcb_set_wm_name (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8, name_len, name);
}
-int
-xcb_get_wm_name (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name)
+xcb_get_property_cookie_t
+xcb_get_wm_name(xcb_connection_t *c,
+ xcb_window_t window)
{
- return xcb_get_text_property(c, window, WM_NAME, format, encoding, name_len, name);
+ return xcb_get_text_property(c, window, WM_NAME);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_name_unchecked(xcb_connection_t *c,
+ xcb_window_t window)
+{
+ return xcb_get_text_property_unchecked(c, window, WM_NAME);
+}
+
+uint8_t
+xcb_get_wm_name_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e)
+{
+ return xcb_get_text_property_reply(c, cookie, prop, e);
}
void
@@ -100,15 +121,27 @@ xcb_set_wm_icon_name (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding, 8, name_len, name);
}
-int
-xcb_get_wm_icon_name (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name)
+xcb_get_property_cookie_t
+xcb_get_wm_icon_name(xcb_connection_t *c,
+ xcb_window_t window)
+{
+ return xcb_get_text_property(c, window, WM_ICON_NAME);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_icon_name_unchecked(xcb_connection_t *c,
+ xcb_window_t window)
{
- return xcb_get_text_property(c, window, WM_ICON_NAME, format, encoding, name_len, name);
+ return xcb_get_text_property_unchecked(c, window, WM_ICON_NAME);
+}
+
+uint8_t
+xcb_get_wm_icon_name_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e)
+{
+ return xcb_get_text_property_reply(c, cookie, prop, e);
}
void
@@ -142,15 +175,27 @@ xcb_set_wm_client_machine (xcb_connection_t *c,
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
}
-int
-xcb_get_wm_client_machine (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name)
+xcb_get_property_cookie_t
+xcb_get_wm_client_machine(xcb_connection_t *c,
+ xcb_window_t window)
+{
+ return xcb_get_text_property(c, window, WM_CLIENT_MACHINE);
+}
+
+xcb_get_property_cookie_t
+xcb_get_wm_client_machine_unchecked(xcb_connection_t *c,
+ xcb_window_t window)
+{
+ return xcb_get_text_property_unchecked(c, window, WM_CLIENT_MACHINE);
+}
+
+uint8_t
+xcb_get_wm_client_machine_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e)
{
- return xcb_get_text_property(c, window, WM_CLIENT_MACHINE, format, encoding, name_len, name);
+ return xcb_get_text_property_reply(c, cookie, prop, e);
}
void
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 749c9e1..108c9bb 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -4,18 +4,72 @@
#include <xcb/xcb.h>
#include "xcb_property.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-int xcb_get_text_property (xcb_connection_t *c,
- xcb_window_t window,
- xcb_atom_t property,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name);
+/**
+ * @brief TextProperty reply structure.
+ */
+typedef struct {
+ /** Store reply to avoid memory allocation, should normally not be
+ used directly */
+ xcb_get_property_reply_t *_reply;
+ /** Encoding used */
+ xcb_atom_t encoding;
+ /** Length of the name field above */
+ uint32_t name_len;
+ /** Property value */
+ char *name;
+ /** Format, may be 8, 16 or 32 */
+ uint8_t format;
+} xcb_get_text_property_reply_t;
+
+/**
+ * @brief Deliver a GetProperty request to the X server.
+ * @param c: The connection to the X server.
+ * @param window: Window X identifier.
+ * @param property: Property atom to get.
+ * @return The request cookie.
+ *
+ * Allow to get a window property, in most case you might want to use
+ * above functions to get an ICCCM property for a given window.
+ */
+xcb_get_property_cookie_t xcb_get_text_property(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property);
+
+/**
+ * @see xcb_get_text_property()
+ */
+xcb_get_property_cookie_t xcb_get_text_property_unchecked(xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property);
+
+/**
+ * @brief Fill given structure with the property value of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: TextProperty request cookie.
+ * @param prop: TextProperty reply which is to be filled.
+ * @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_text_property_unchecked() is used. Otherwise, it stores
+ * the error if any. prop structure members should be freed by
+ * xcb_get_text_property_reply_wipe().
+ */
+uint8_t xcb_get_text_property_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e);
+
+/**
+ * @brief Wipe prop structure members previously allocated by
+ * xcb_get_text_property_reply().
+ * @param prop: prop structure whose members is going to be freed.
+ */
+void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop);
/* WM_NAME */
@@ -31,12 +85,34 @@ void xcb_set_wm_name (xcb_connection_t *c,
uint32_t name_len,
const char *name);
-int xcb_get_wm_name (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name);
+/**
+ * @brief Deliver a GetProperty request to the X server for WM_NAME.
+ * @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_name(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_name()
+ */
+xcb_get_property_cookie_t xcb_get_wm_name_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_NAME property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param prop: WM_NAME property value.
+ * @param e: Error if any.
+ * @see xcb_get_text_property_reply()
+ * @return Return 1 on success, 0 otherwise.
+ */
+uint8_t xcb_get_wm_name_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e);
void xcb_watch_wm_name (xcb_property_handlers_t *prophs,
uint32_t long_len,
@@ -57,12 +133,34 @@ void xcb_set_wm_icon_name (xcb_connection_t *c,
uint32_t name_len,
const char *name);
-int xcb_get_wm_icon_name (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name);
+/**
+ * @brief Send request to get WM_ICON_NAME property of a 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_icon_name(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_icon_name()
+ */
+xcb_get_property_cookie_t xcb_get_wm_icon_name_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_ICON_NAME property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param prop: WM_ICON_NAME property value.
+ * @param e: Error if any.
+ * @see xcb_get_text_property_reply()
+ * @return Return 1 on success, 0 otherwise.
+ */
+uint8_t xcb_get_wm_icon_name_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e);
void xcb_watch_wm_icon_name (xcb_property_handlers_t *prophs,
uint32_t long_len,
@@ -83,12 +181,34 @@ void xcb_set_wm_client_machine (xcb_connection_t *c,
uint32_t name_len,
const char *name);
-int xcb_get_wm_client_machine (xcb_connection_t *c,
- xcb_window_t window,
- uint8_t *format,
- xcb_atom_t *encoding,
- uint32_t *name_len,
- char **name);
+/**
+ * @brief Send request to get WM_CLIENT_MACHINE property of a 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_client_machine(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @see xcb_get_wm_client_machine()
+ */
+xcb_get_property_cookie_t xcb_get_wm_client_machine_unchecked(xcb_connection_t *c,
+ xcb_window_t window);
+
+/**
+ * @brief Fill given structure with the WM_CLIENT_MACHINE property of a window.
+ * @param c: The connection to the X server.
+ * @param cookie: Request cookie.
+ * @param prop: WM_CLIENT_MACHINE property value.
+ * @param e: Error if any.
+ * @see xcb_get_text_property_reply()
+ * @return Return 1 on success, 0 otherwise.
+ */
+uint8_t xcb_get_wm_client_machine_reply(xcb_connection_t *c,
+ xcb_get_property_cookie_t cookie,
+ xcb_get_text_property_reply_t *prop,
+ xcb_generic_error_t **e);
void xcb_watch_wm_client_machine (xcb_property_handlers_t *prophs,
uint32_t long_len,
commit 865ac9e155620b8bebe4feb98265fd90b3e8c808
Author: Arnaud Fontaine <arnau at debian.org>
Date: Thu Sep 11 19:06:57 2008 +0200
[atom] Move '*discriminated_atom*' functions from icccm to atom
diff --git a/atom/atoms.gperf.m4 b/atom/atoms.gperf.m4
index ec733de..b51122c 100644
--- a/atom/atoms.gperf.m4
+++ b/atom/atoms.gperf.m4
@@ -1,6 +1,15 @@
%{
+
+/* Rely on vasprintf (GNU extension) instead of vsnprintf if
+ possible... */
+#ifdef HAVE_VASPRINTF
+#define _GNU_SOURCE
+#include <stdio.h>
+#endif
+
#include <xcb/xcb.h>
#include <stdlib.h>
+#include <stdarg.h>
#include "xcb_atom.h"
define(`COUNT', 0)dnl
@@ -113,3 +122,68 @@ int get_atom_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int
free(atomr);
return 1;
}
+
+static char *makename(const char *fmt, ...)
+{
+ char *ret;
+ int n;
+ va_list ap;
+
+#ifndef HAVE_VASPRINTF
+ char *np;
+ int size = 64;
+
+ /* First allocate 'size' bytes, should be enough usually */
+ if((ret = malloc(size)) == NULL)
+ return NULL;
+
+ while(1)
+ {
+ va_start(ap, fmt);
+ n = vsnprintf(ret, size, fmt, ap);
+ va_end(ap);
+
+ if(n < 0)
+ return NULL;
+
+ if(n < size)
+ return ret;
+
+ size = n + 1;
+ if((np = realloc(ret, size)) == NULL)
+ {
+ free(ret);
+ return NULL;
+ }
+
+ ret = np;
+ }
+#else
+ va_start(ap, fmt);
+ n = vasprintf(&ret, fmt, ap);
+ va_end(ap);
+
+ if(n < 0)
+ return NULL;
+
+ return ret;
+#endif
+}
+
+char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
+{
+ return makename("%s_S%u", base, screen);
+}
+
+char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
+{
+ return makename("%s_R%08X", base, resource);
+}
+
+char *xcb_atom_name_unique(const char *base, uint32_t id)
+{
+ if(base)
+ return makename("%s_U%lu", base, id);
+ else
+ return makename("U%lu", id);
+}
diff --git a/atom/xcb_atom.h.m4 b/atom/xcb_atom.h.m4
index 6ea81d3..48e874f 100644
--- a/atom/xcb_atom.h.m4
+++ b/atom/xcb_atom.h.m4
@@ -20,6 +20,10 @@ xcb_atom_t intern_atom_fast_reply(xcb_connection_t *c, intern_atom_fast_cookie_t
const char *get_atom_name_predefined(xcb_atom_t atom);
int get_atom_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp);
+char *xcb_atom_name_by_screen(const char *base, uint8_t screen);
+char *xcb_atom_name_by_resource(const char *base, uint32_t resource);
+char *xcb_atom_name_unique(const char *base, uint32_t id);
+
define(`DO', `extern const xcb_atom_t $1;')dnl
include(atomlist.m4)`'dnl
diff --git a/configure.ac b/configure.ac
index a40db6d..b8c0bb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ else
fi
fi
AC_SUBST(CWARNFLAGS)
+AC_CHECK_FUNCS_ONCE(vasprintf)
xcbincludedir='${includedir}/xcb'
AC_SUBST(xcbincludedir)
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 2128bd0..1a5e864 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -774,37 +774,3 @@ xcb_get_wm_protocols (xcb_connection_t *c,
free(rep);
return 0;
}
-
-#if HAS_DISCRIMINATED_NAME
-#include <stdarg.h>
-static char *makename(const char *fmt, ...)
-{
- char *ret;
- int n;
- va_list ap;
- va_start(ap, fmt);
- n = vasprintf(&ret, fmt, ap);
- va_end(ap);
- if(n < 0)
- return 0;
- return ret;
-}
-
-char *discriminated_atom_name_by_screen(const char *base, uint8_t screen)
-{
- return makename("%s_S%u", base, screen);
-}
-
-char *discriminated_atom_name_by_resource(const char *base, uint32_t resource)
-{
- return makename("%s_R%08X", base, resource);
-}
-
-char *discriminated_atom_name_unique(const char *base, uint32_t id)
-{
- if(base)
- return makename("%s_U%lu", base, id);
- else
- return makename("U%lu", id);
-}
-#endif
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 2711aec..749c9e1 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -295,14 +295,6 @@ int xcb_get_wm_protocols (xcb_connection_t *c,
uint32_t *list_len,
xcb_atom_t **list);
-#define HAS_DISCRIMINATED_NAME 0
-#if HAS_DISCRIMINATED_NAME
-char *discriminated_atom_name_by_screen (const char *base, uint8_t screen);
-char *discriminated_atom_name_by_resource (const char *base, uint32_t resource);
-char *discriminated_atom_name_unique (const char *base, uint32_t id);
-#endif
-
-
#ifdef __cplusplus
}
#endif
commit 94ca80dcd6a03b8560043f8adc05c33b7c7e3e25
Author: Arnaud Fontaine <arnau at debian.org>
Date: Sat Aug 9 14:14:34 2008 +0200
[property] Add missing xcb_get_any_property_unchecked().
diff --git a/property/prop.c b/property/prop.c
index d6b8986..751afdf 100644
--- a/property/prop.c
+++ b/property/prop.c
@@ -29,6 +29,18 @@ xcb_get_property_cookie_t xcb_get_any_property(xcb_connection_t *c, uint8_t del,
return xcb_get_property(c, del, window, name, type, 0, long_len);
}
+xcb_get_property_cookie_t xcb_get_any_property_unchecked(xcb_connection_t *c,
+ uint8_t del,
+ xcb_window_t window,
+ xcb_atom_t name,
+ uint32_t long_len)
+{
+ static const xcb_atom_t type = XCB_GET_PROPERTY_TYPE_ANY;
+
+ return xcb_get_property_unchecked(c, del, window, name, type, 0,
+ long_len);
+}
+
static int call_handler(xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, prop_handler_t *h)
{
xcb_get_property_reply_t *propr = 0;
diff --git a/property/xcb_property.h b/property/xcb_property.h
index 6c90d92..2a7b4e7 100644
--- a/property/xcb_property.h
+++ b/property/xcb_property.h
@@ -10,6 +10,11 @@ extern "C" {
xcb_get_property_cookie_t xcb_get_any_property(xcb_connection_t *c, uint8_t del, xcb_window_t window, xcb_atom_t name, uint32_t long_len);
+xcb_get_property_cookie_t xcb_get_any_property_unchecked(xcb_connection_t *c,
+ uint8_t del,
+ xcb_window_t window,
+ xcb_atom_t name,
+ uint32_t long_len);
typedef struct xcb_property_handlers xcb_property_handlers_t;
commit 35346581f90e842172389f7e3cb81637bdec6872
Author: Arnaud Fontaine <arnau at debian.org>
Date: Sat Aug 9 14:12:26 2008 +0200
[icccm] Make xcb_get_text_property() public as it might be useful for
upper-level applications.
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 3550c5a..2128bd0 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -4,7 +4,7 @@
#include "xcb_atom.h"
-static int
+int
xcb_get_text_property(xcb_connection_t *c,
xcb_window_t window,
xcb_atom_t property,
diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 0f01b50..2711aec 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -9,6 +9,13 @@
extern "C" {
#endif
+int xcb_get_text_property (xcb_connection_t *c,
+ xcb_window_t window,
+ xcb_atom_t property,
+ uint8_t *format,
+ xcb_atom_t *encoding,
+ uint32_t *name_len,
+ char **name);
/* WM_NAME */
More information about the xcb-commit
mailing list