diff options
author | Colomban Wendling <[email protected]> | 2020-08-05 16:21:43 +0200 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2020-08-08 23:24:58 +0200 |
commit | 7fb8e162baf14c632fb863efe034f298b5d1d174 (patch) | |
tree | 9990f23c24c434dfb1b7e83982d32698213ce4e5 /plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c | |
parent | 7c0d9fa87266156e3bb88a2f89386da17ea47a47 (diff) | |
download | mate-settings-daemon-7fb8e162baf14c632fb863efe034f298b5d1d174.tar.bz2 mate-settings-daemon-7fb8e162baf14c632fb863efe034f298b5d1d174.tar.xz |
a11y-keyboard: capslock-beep: Try and detect non-buggy libatspi2
Try and avoid the workaround for buggy libatspi2 if we can know the
version we're using has it fixed.
Diffstat (limited to 'plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c')
-rw-r--r-- | plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c b/plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c index a1d7c9c..bae815e 100644 --- a/plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c +++ b/plugins/a11y-keyboard/msd-a11y-keyboard-atspi.c @@ -27,10 +27,6 @@ #include <gdk/gdk.h> #include <atspi/atspi.h> -/* See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/22 */ -#define DESTROYING_ATSPI_LISTENER_CRASHES 1 - - struct MsdA11yKeyboardAtspiPrivate { AtspiDeviceListener *listener; @@ -80,14 +76,15 @@ msd_a11y_keyboard_atspi_init (MsdA11yKeyboardAtspi *self) self->priv->listener = NULL; self->priv->listening = FALSE; -#if DESTROYING_ATSPI_LISTENER_CRASHES +#ifndef DESTROYING_ATSPI_LISTENER_DOES_NOT_CRASH /* init AT-SPI if needed */ atspi_init (); self->priv->listener = atspi_device_listener_new (on_key_press_event, self, NULL); /* leak a reference so that this listener is *never* destroyed, to - * prevent the crash even if our object gets destroyed. */ + * prevent the crash even if our object gets destroyed. + * See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/22 */ g_object_ref (self->priv->listener); #endif } @@ -129,7 +126,7 @@ msd_a11y_keyboard_atspi_start (MsdA11yKeyboardAtspi *self) if (self->priv->listening) return; -#if ! DESTROYING_ATSPI_LISTENER_CRASHES +#ifdef DESTROYING_ATSPI_LISTENER_DOES_NOT_CRASH /* init AT-SPI if needed */ atspi_init (); @@ -148,10 +145,10 @@ msd_a11y_keyboard_atspi_stop (MsdA11yKeyboardAtspi *self) if (! self->priv->listening) return; -#if DESTROYING_ATSPI_LISTENER_CRASHES - register_deregister_events (self, FALSE); -#else +#ifdef DESTROYING_ATSPI_LISTENER_DOES_NOT_CRASH g_clear_object (&self->priv->listener); +#else + register_deregister_events (self, FALSE); #endif self->priv->listening = FALSE; } |