static void die_cb(SmcConn connection, SmPointer client_data) { struct userdata *u = client_data; pa_assert(u); pa_log_debug("Got die message from XSMP."); pa_x11_wrapper_kill(u->x11); pa_x11_wrapper_unref(u->x11); u->x11 = NULL; pa_module_unload_request(u->module, TRUE); }
void pa_x11_wrapper_kill(pa_x11_wrapper *w) { pa_x11_client *c, *n; pa_assert(w); pa_x11_wrapper_ref(w); for (c = w->clients; c; c = n) { n = c->next; if (c->kill_cb) c->kill_cb(w, c->userdata); } pa_x11_wrapper_unref(w); }
static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) { struct userdata *u = userdata; pa_assert(w); pa_assert(u); pa_assert(u->x11_wrapper == w); if (u->x11_client) pa_x11_client_free(u->x11_client); if (u->x11_wrapper) pa_x11_wrapper_unref(u->x11_wrapper); u->x11_client = NULL; u->x11_wrapper = NULL; pa_module_unload_request(u->module, true); }
void pa__done(pa_module*m) { struct userdata*u; pa_assert(m); if (!(u = m->userdata)) return; if (u->x11_client) pa_x11_client_free(u->x11_client); if (u->x11_wrapper) pa_x11_wrapper_unref(u->x11_wrapper); if (u->hook_slot) pa_hook_slot_free(u->hook_slot); pa_xfree(u); }
void pa__done(pa_module*m) { struct userdata*u; pa_assert(m); if (!(u = m->userdata)) return; if (u->x11_client) pa_x11_client_free(u->x11_client); if (u->x11_wrapper) { char t[256]; int screen = DefaultScreen(pa_x11_wrapper_get_display(u->x11_wrapper)); /* Yes, here is a race condition */ if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID", t, sizeof(t)) || !pa_streq(t, u->id)) pa_log_warn("PulseAudio information vanished from X11!"); else { pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID"); pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_SERVER"); pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_SINK"); pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_SOURCE"); pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_COOKIE"); pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_SESSION_ID"); xcb_flush(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper)); } pa_x11_wrapper_unref(u->x11_wrapper); } if (u->auth_cookie) pa_auth_cookie_unref(u->auth_cookie); if (u->hook_slot) pa_hook_slot_free(u->hook_slot); if (u->protocol) pa_native_protocol_unref(u->protocol); pa_xfree(u->id); pa_xfree(u); }
/* Dispatch all pending X11 events */ static void work(pa_x11_wrapper *w) { pa_assert(w); pa_assert(PA_REFCNT_VALUE(w) >= 1); pa_x11_wrapper_ref(w); while (XPending(w->display)) { pa_x11_client *c, *n; XEvent e; XNextEvent(w->display, &e); for (c = w->clients; c; c = n) { n = c->next; if (c->event_cb) if (c->event_cb(w, &e, c->userdata) != 0) break; } } pa_x11_wrapper_unref(w); }
void pa__done(pa_module*m) { struct userdata *u; pa_assert(m); if ((u = m->userdata)) { if (u->connection) SmcCloseConnection(u->connection, 0, NULL); if (u->client) pa_client_free(u->client); if (u->x11) pa_x11_wrapper_unref(u->x11); pa_xfree(u); } if (ice_in_use) { IceRemoveConnectionWatch(new_ice_connection, m->core); ice_in_use = FALSE; } }