summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/pulsecore/x11prop.c38
2 files changed, 26 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index 299dd490..ed9bd172 100644
--- a/configure.ac
+++ b/configure.ac
@@ -547,7 +547,7 @@ AC_ARG_ENABLE([x11],
[x11=auto])
if test "x${x11}" != xno ; then
- PKG_CHECK_MODULES(X11, [ x11-xcb ice sm xtst xcb-atom ],
+ PKG_CHECK_MODULES(X11, [ x11-xcb xcb >= 1.6 ice sm xtst ],
HAVE_X11=1,
[
HAVE_X11=0
diff --git a/src/pulsecore/x11prop.c b/src/pulsecore/x11prop.c
index d66c48f5..8fca2195 100644
--- a/src/pulsecore/x11prop.c
+++ b/src/pulsecore/x11prop.c
@@ -30,7 +30,6 @@
#include <pulsecore/macro.h>
#include <xcb/xproto.h>
-#include <xcb/xcb_atom.h>
#define PA_XCB_FORMAT 8
@@ -50,7 +49,6 @@ static xcb_screen_t *screen_of_display(xcb_connection_t *xcb, int screen)
void pa_x11_set_prop(xcb_connection_t *xcb, int screen, const char *name, const char *data) {
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
@@ -58,26 +56,36 @@ void pa_x11_set_prop(xcb_connection_t *xcb, int screen, const char *name, const
pa_assert(data);
if ((xs = screen_of_display(xcb, screen))) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
- xcb_change_property(xcb, XCB_PROP_MODE_REPLACE, xs->root, reply->atom, XCB_ATOM_STRING, PA_XCB_FORMAT, (int) strlen(data), (const void*) data);
+ if (reply) {
+ xcb_change_property(xcb, XCB_PROP_MODE_REPLACE, xs->root, reply->atom,
+ XCB_ATOM_STRING, PA_XCB_FORMAT,
+ (int) strlen(data), (const void*) data);
+
+ free(reply);
+ }
}
}
void pa_x11_del_prop(xcb_connection_t *xcb, int screen, const char *name) {
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
pa_assert(name);
if ((xs = screen_of_display(xcb, screen))) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
-
- xcb_delete_property(xcb, xs->root, reply->atom);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
+
+ if (reply) {
+ xcb_delete_property(xcb, xs->root, reply->atom);
+ free(reply);
+ }
}
}
@@ -87,7 +95,6 @@ char* pa_x11_get_prop(xcb_connection_t *xcb, int screen, const char *name, char
xcb_get_property_cookie_t req;
xcb_get_property_reply_t* prop = NULL;
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
@@ -106,10 +113,15 @@ char* pa_x11_get_prop(xcb_connection_t *xcb, int screen, const char *name, char
xs = screen_of_display(xcb, 0);
if (xs) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
+
+ if (!reply)
+ goto finish;
req = xcb_get_property(xcb, 0, xs->root, reply->atom, XCB_ATOM_STRING, 0, (uint32_t)(l-1));
+ free(reply);
prop = xcb_get_property_reply(xcb, req, NULL);
if (!prop)