diff options
author | Colin Guthrie <cguthrie@mandriva.org> | 2010-05-29 19:33:54 +0100 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2010-08-15 21:41:52 +0100 |
commit | 2b88634671d1b745b1364e9cf4827e30a5ff2a6e (patch) | |
tree | eb453f9e6c9eb70fb34a8483aca9ab8e72b7cb26 /src/pulse | |
parent | 4a1072e0bcce9165a262dc76a12baa2680caa0e3 (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
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/client-conf-x11.c | 23 |
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; |