diff options
author | Florian Müllner <fmuellner@gnome.org> | 2019-05-27 20:43:21 +0000 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2019-05-28 14:34:32 +0000 |
commit | a2c545c32123a01d3a7bc4c44c86ab497df02182 (patch) | |
tree | 332ab9e6326118da8e7c2178f5b218855da63250 | |
parent | 3cd8f3b7dc5ef930187a6123b8dcf9148dd5f830 (diff) | |
download | mutter-a2c545c32123a01d3a7bc4c44c86ab497df02182.tar.gz |
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
-rw-r--r-- | src/x11/meta-x11-display.c | 39 |
1 files 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); |