From 2b88634671d1b745b1364e9cf4827e30a5ff2a6e Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sat, 29 May 2010 19:33:54 +0100 Subject: 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 --- src/pulse/client-conf-x11.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/pulse') 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 -#include -#include +#include #include #include @@ -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; -- cgit