From a2c545c32123a01d3a7bc4c44c86ab497df02182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 27 May 2019 20:43:21 +0000 Subject: [PATCH] x11-display: Simplify bell handling Since commit 956ab4bd made libcanberra mandatory, we never use the system bell for handling the `audible-bell` setting. So instead of reacting to settings changes with the exact same call to XkbChangeEnabledControls(), just call it once when initializing. https://gitlab.gnome.org/GNOME/mutter/merge_requests/598 --- src/x11/meta-x11-display.c | 39 +++++++------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index e9a73b249..665600938 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -490,6 +490,13 @@ init_x11_bell (MetaX11Display *x11_display) &mask); } } + + /* We are playing sounds using libcanberra support, we handle the + * bell whether its an audible bell or a visible bell */ + XkbChangeEnabledControls (x11_display->xdisplay, + XkbUseCoreKbd, + XkbAudibleBellMask, + 0); } /* @@ -507,32 +514,6 @@ shutdown_x11_bell (MetaX11Display *x11_display) XkbAudibleBellMask); } -/* - * Turns the bell to audible or visual. This tells X what to do, but - * not Mutter; you will need to set the "visual bell" pref for that. - */ -static void -set_x11_bell_is_audible (MetaX11Display *x11_display, - gboolean is_audible) -{ - /* When we are playing sounds using libcanberra support, we handle the - * bell whether its an audible bell or a visible bell */ - gboolean enable_system_bell = FALSE; - - XkbChangeEnabledControls (x11_display->xdisplay, - XkbUseCoreKbd, - XkbAudibleBellMask, - enable_system_bell ? XkbAudibleBellMask : 0); -} - -static void -on_is_audible_changed (MetaBell *bell, - gboolean is_audible, - MetaX11Display *x11_display) -{ - set_x11_bell_is_audible (x11_display, is_audible); -} - static void set_desktop_geometry_hint (MetaX11Display *x11_display) { @@ -1351,12 +1332,6 @@ meta_x11_display_new (MetaDisplay *display, GError **error) init_x11_bell (x11_display); - g_signal_connect_object (display->bell, "is-audible-changed", - G_CALLBACK (on_is_audible_changed), - x11_display, 0); - - set_x11_bell_is_audible (x11_display, meta_prefs_bell_is_audible ()); - meta_x11_startup_notification_init (x11_display); meta_x11_selection_init (x11_display);