]>
code.delx.au - pulseaudio/blob - polyp/client-conf-x11.c
f667bd784b2176eb742cf11d3a8e19b664c3a04f
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30 #include <X11/Xatom.h>
32 #include "client-conf-x11.h"
38 int pa_client_conf_from_x11(struct pa_client_conf
*c
, const char *dname
) {
43 if (!dname
&& !getenv("DISPLAY"))
46 if (!(d
= XOpenDisplay(dname
))) {
47 pa_log(__FILE__
": XOpenDisplay() failed\n");
51 if (!pa_x11_get_prop(d
, "POLYP_SERVER", t
, sizeof(t
)))
54 pa_xfree(c
->default_server
);
55 c
->default_server
= pa_xstrdup(t
);
57 if (pa_x11_get_prop(d
, "POLYP_SINK", t
, sizeof(t
))) {
58 pa_xfree(c
->default_sink
);
59 c
->default_sink
= pa_xstrdup(t
);
62 if (pa_x11_get_prop(d
, "POLYP_SOURCE", t
, sizeof(t
))) {
63 pa_xfree(c
->default_source
);
64 c
->default_source
= pa_xstrdup(t
);
67 if (pa_x11_get_prop(d
, "POLYP_COOKIE", t
, sizeof(t
))) {
68 uint8_t cookie
[PA_NATIVE_COOKIE_LENGTH
];
70 if (pa_parsehex(t
, cookie
, sizeof(cookie
)) != sizeof(cookie
)) {
71 pa_log(__FILE__
": failed to parse cookie data\n");
75 assert(sizeof(cookie
) == sizeof(c
->cookie
));
76 memcpy(c
->cookie
, cookie
, sizeof(cookie
));
80 pa_xfree(c
->cookie_file
);
81 c
->cookie_file
= NULL
;