X bell is not re-enabled after pulseaudio exits / x11-beel is unloaded (XkbSetAutoResetControls)
Submitted by Daniel Hahler
Assigned to pul..@..op.org
Description
The following code is used in src/modules/x11/module-x11-bell.c to disable the audible bell:
XkbChangeEnabledControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbUseCoreKbd, XkbAudibleBellMask, 0);
..after the following code, which is meant to re-enable/reset it after the X client quits:
auto_ctrls = auto_values = XkbAudibleBellMask; XkbSetAutoResetControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbAudibleBellMask, &auto_ctrls, &auto_values);
But this either has a bug somewhere or just does not work as expected.
I am not sure where / how the (wrapped) X client is supposed to get closed.
TEST CASE:
-
Add "autospawn=no" to ~/.pulse/client.conf
-
Kill pulseaudio: pulseaudio -k
-
Start a new X session, and/or make sure that the audible bell is enabled, e.g. "xset b 100". You can use printf '\a' in a terminal to trigger it.
-
Start pulseaudio and load the x11-bell module:
pactl load-module module-x11-bell sample=bell.ogg pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg
-
The bell should either get routed through PA now (if you have a "bell" sample uploaded), fallback to the speaker or you will hear nothing (Bug 58930).
-
Unload the module again:
pactl unload-module module-x11-bell
EXPECTED: Now the default X bell should be enabled again.
ACTUAL RESULT: Nothing happens on a bell event now: pulseaudio is stopped and the previous state has not been restored.
A workaround is to (unconditionally) enable the X bell again when the x11-bell module gets unloaded, but then it might get enabled, although it wasn't before:
XkbChangeEnabledControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbUseCoreKbd, XkbAudibleBellMask, XkbAudibleBellMask);