summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2020-08-05 19:26:58 +0200
committerRobert Antoni Buj Gelonch <[email protected]>2020-09-05 18:02:41 +0200
commit7fc62dcf0d80f9fc8b6adc92aca3f837060e55c1 (patch)
tree9b370a13a609b784d29ecc1f65e833730682c757
parent4f45e7f964fef34e18f27cf6a844b3f2898860c0 (diff)
downloadmate-settings-daemon-7fc62dcf0d80f9fc8b6adc92aca3f837060e55c1.tar.bz2
mate-settings-daemon-7fc62dcf0d80f9fc8b6adc92aca3f837060e55c1.tar.xz
a11y-keyboard: Add support for togglekeys-backend setting
-rw-r--r--plugins/a11y-keyboard/msd-a11y-keyboard-manager.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
index 1441ca6..e383ebd 100644
--- a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
@@ -81,6 +81,14 @@ struct MsdA11yKeyboardManagerPrivate
#endif /* HAVE_LIBNOTIFY */
};
+/* Keep in sync with the org.mate.accessibility-keyboard.TogglekeysBackend
+ * enum from the org.mate.accessibility-keyboard schema. */
+typedef enum
+{
+ TOGGLEKEYS_BACKEND_XKB,
+ TOGGLEKEYS_BACKEND_INTERNAL,
+} TogglekeysBackend;
+
static void msd_a11y_keyboard_manager_finalize (GObject *object);
static void msd_a11y_keyboard_manager_ensure_status_icon (MsdA11yKeyboardManager *manager);
static void set_server_from_settings (MsdA11yKeyboardManager *manager);
@@ -89,6 +97,14 @@ G_DEFINE_TYPE_WITH_PRIVATE (MsdA11yKeyboardManager, msd_a11y_keyboard_manager, G
static gpointer manager_object = NULL;
+static gboolean
+togglekeys_backend_enabled (MsdA11yKeyboardManager *manager,
+ TogglekeysBackend backend)
+{
+ return (g_settings_get_boolean (manager->priv->settings, "togglekeys-enable") &&
+ g_settings_get_enum (manager->priv->settings, "togglekeys-backend") == (gint) backend);
+}
+
static GdkFilterReturn
devicepresence_filter (GdkXEvent *xevent,
GdkEvent *event,
@@ -369,7 +385,7 @@ set_server_from_settings (MsdA11yKeyboardManager *manager)
}
/* toggle keys */
- desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "togglekeys-enable"),
+ desc->ctrls->ax_options = set_clear (togglekeys_backend_enabled (manager, TOGGLEKEYS_BACKEND_XKB),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
@@ -920,9 +936,11 @@ set_settings_from_server (MsdA11yKeyboardManager *manager)
"stickykeys-modifier-beep",
desc->ctrls->ax_options & XkbAX_StickyKeysFBMask);
- changed |= set_bool (settings,
- "togglekeys-enable",
- desc->ctrls->ax_options & XkbAX_IndicatorFBMask);
+ if (g_settings_get_enum (manager->priv->settings, "togglekeys-backend") == TOGGLEKEYS_BACKEND_XKB) {
+ changed |= set_bool (settings,
+ "togglekeys-enable",
+ desc->ctrls->ax_options & XkbAX_IndicatorFBMask);
+ }
if (!changed && stickykeys_changed ^ slowkeys_changed) {
/*
@@ -1031,7 +1049,7 @@ cb_xkb_event_filter (GdkXEvent *xevent,
}
} else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
xkbEv->any.xkb_type == XkbIndicatorStateNotify &&
- g_settings_get_boolean (manager->priv->settings, "togglekeys-enable")) {
+ togglekeys_backend_enabled (manager, TOGGLEKEYS_BACKEND_INTERNAL)) {
GdkDisplay *display = gdk_x11_lookup_xdisplay (xkbEv->any.display);
gint beep_count;
gint beep_delay;