summaryrefslogtreecommitdiffstats
path: root/src/pulse/client-conf-x11.c
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2010-05-29 19:33:54 +0100
committerColin Guthrie <cguthrie@mandriva.org>2010-09-18 12:04:09 +0100
commit38778117f8e03f32ec5af8684a1013cc7807d66d (patch)
tree07d696e8bae6ea5f6c77c60c93942c2b4e52770e /src/pulse/client-conf-x11.c
parent2ecd764662174bf81b90cfa057104dec103bfeec (diff)
x11: Partially convert to XCB.
This commit mostly converts the X11 handling to XCB. There are still some uses of XLib to deal with the X11 session handling modules, however all client-side code should now be free of XLib and thus this should fix Bug #799 Note that this removes the screen-based changes by Leszek Koltunski in 65e80, however this will be restored in due course.
Diffstat (limited to 'src/pulse/client-conf-x11.c')
-rw-r--r--src/pulse/client-conf-x11.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 4970363b..565f997d 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -25,8 +25,7 @@
#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
+#include <xcb/xcb.h>
#include <pulse/xmalloc.h>
#include <pulse/i18n.h>
@@ -39,7 +38,7 @@
#include "client-conf-x11.h"
int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
- Display *d = NULL;
+ xcb_connection_t *xcb = NULL;
int ret = -1;
char t[1024];
@@ -51,18 +50,18 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
if (*dname == 0)
goto finish;
- if (!(d = XOpenDisplay(dname))) {
- pa_log(_("XOpenDisplay() failed"));
+ if (!(xcb = xcb_connect(dname, NULL))) {
+ pa_log(_("xcb_connect() failed"));
goto finish;
}
- if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) {
+ if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t))) {
pa_bool_t disable_autospawn = TRUE;
pa_xfree(c->default_server);
c->default_server = pa_xstrdup(t);
- if (pa_x11_get_prop(d, "PULSE_SESSION_ID", t, sizeof(t))) {
+ if (pa_x11_get_prop(xcb, "PULSE_SESSION_ID", t, sizeof(t))) {
char *id;
if ((id = pa_session_id())) {
@@ -76,17 +75,17 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
c->autospawn = FALSE;
}
- if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) {
+ if (pa_x11_get_prop(xcb, "PULSE_SINK", t, sizeof(t))) {
pa_xfree(c->default_sink);
c->default_sink = pa_xstrdup(t);
}
- if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t))) {
+ if (pa_x11_get_prop(xcb, "PULSE_SOURCE", t, sizeof(t))) {
pa_xfree(c->default_source);
c->default_source = pa_xstrdup(t);
}
- if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t))) {
+ if (pa_x11_get_prop(xcb, "PULSE_COOKIE", t, sizeof(t))) {
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
if (pa_parsehex(t, cookie, sizeof(cookie)) != sizeof(cookie)) {
@@ -106,8 +105,8 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
ret = 0;
finish:
- if (d)
- XCloseDisplay(d);
+ if (xcb)
+ xcb_disconnect(xcb);
return ret;