mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
client-conf-x11: unbreak autospawn due to stale X11 properties
If the X11 property data is from the same session than the client the client may do autospawning in case the X11 property data is stale. Closes #518.
This commit is contained in:
parent
0aed5ea2e1
commit
0ac038e591
2 changed files with 22 additions and 1 deletions
|
|
@ -136,7 +136,7 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) {
|
||||||
int pa__init(pa_module*m) {
|
int pa__init(pa_module*m) {
|
||||||
struct userdata *u;
|
struct userdata *u;
|
||||||
pa_modargs *ma = NULL;
|
pa_modargs *ma = NULL;
|
||||||
char *mid;
|
char *mid, *sid;
|
||||||
char hx[PA_NATIVE_COOKIE_LENGTH*2+1];
|
char hx[PA_NATIVE_COOKIE_LENGTH*2+1];
|
||||||
const char *t;
|
const char *t;
|
||||||
|
|
||||||
|
|
@ -170,6 +170,11 @@ int pa__init(pa_module*m) {
|
||||||
|
|
||||||
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", u->id);
|
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", u->id);
|
||||||
|
|
||||||
|
if ((sid = pa_session_id())) {
|
||||||
|
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SESSION_ID", sid);
|
||||||
|
pa_xfree(sid);
|
||||||
|
}
|
||||||
|
|
||||||
publish_servers(u, pa_native_protocol_servers(u->protocol));
|
publish_servers(u, pa_native_protocol_servers(u->protocol));
|
||||||
|
|
||||||
if ((t = pa_modargs_get_value(ma, "source", NULL)))
|
if ((t = pa_modargs_get_value(ma, "source", NULL)))
|
||||||
|
|
@ -219,6 +224,7 @@ void pa__done(pa_module*m) {
|
||||||
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SINK");
|
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SINK");
|
||||||
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SOURCE");
|
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SOURCE");
|
||||||
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_COOKIE");
|
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_COOKIE");
|
||||||
|
pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SESSION_ID");
|
||||||
XSync(pa_x11_wrapper_get_display(u->x11_wrapper), False);
|
XSync(pa_x11_wrapper_get_display(u->x11_wrapper), False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,23 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) {
|
if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) {
|
||||||
|
pa_bool_t disable_autospawn = TRUE;
|
||||||
|
|
||||||
pa_xfree(c->default_server);
|
pa_xfree(c->default_server);
|
||||||
c->default_server = pa_xstrdup(t);
|
c->default_server = pa_xstrdup(t);
|
||||||
|
|
||||||
|
if (pa_x11_get_prop(d, "PULSE_SESSION_ID", t, sizeof(t))) {
|
||||||
|
char *id;
|
||||||
|
|
||||||
|
if ((id = pa_session_id())) {
|
||||||
|
if (pa_streq(t, id))
|
||||||
|
disable_autospawn = FALSE;
|
||||||
|
pa_xfree(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disable_autospawn)
|
||||||
|
c->autospawn = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) {
|
if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue