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
This commit is contained in:
Florian Müllner 2019-05-27 20:43:21 +00:00 committed by Georges Basile Stavracas Neto
parent 3cd8f3b7dc
commit a2c545c321

View File

@ -490,6 +490,13 @@ init_x11_bell (MetaX11Display *x11_display)
&mask); &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); 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 static void
set_desktop_geometry_hint (MetaX11Display *x11_display) set_desktop_geometry_hint (MetaX11Display *x11_display)
{ {
@ -1351,12 +1332,6 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
init_x11_bell (x11_display); 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_startup_notification_init (x11_display);
meta_x11_selection_init (x11_display); meta_x11_selection_init (x11_display);