[gtk+/matthiasc/wayland/slowkeys: 7/9] wayland: implement toggle keys
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/matthiasc/wayland/slowkeys: 7/9] wayland: implement toggle keys
- Date: Thu, 3 Mar 2016 06:42:00 +0000 (UTC)
commit 2cdcae847307ccf0b2ab98ce0ea6e5d70cf71c55
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 2 22:53:19 2016 -0500
wayland: implement toggle keys
A simple client-side implementation of the AccessX toggle keys
feature.
gdk/wayland/gdkdevice-wayland.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index b6fb749..83f841a 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1810,6 +1810,17 @@ get_bounce_keys_delay (GdkWaylandDeviceData *device)
return 100;
}
+static gboolean
+get_toggle_keys_enabled (GdkWaylandDeviceData *device)
+{
+ GSettings *a11y_settings = get_a11y_settings (device);
+
+ if (a11y_settings)
+ return g_settings_get_boolean (a11y_settings, "togglekeys-enable");
+
+ return FALSE;
+}
+
static void start_key_repeat (GdkWaylandDeviceData *device,
uint32_t key);
@@ -1898,6 +1909,18 @@ stop_bounce_keys (GdkWaylandDeviceData *device)
}
static void
+toggle_keys_apply (GdkWaylandDeviceData *device,
+ GdkModifierType from,
+ GdkModifierType to)
+{
+ if (get_toggle_keys_enabled (device))
+ {
+ if ((from ^ to) & (GDK_LOCK_MASK | GDK_MOD4_MASK))
+ gdk_display_beep (device->display);
+ }
+}
+
+static void
start_key_repeat (GdkWaylandDeviceData *device,
uint32_t key)
{
@@ -2134,14 +2157,18 @@ keyboard_handle_modifiers (void *data,
GdkKeymap *keymap;
struct xkb_state *xkb_state;
PangoDirection direction;
+ GdkModifierType modifiers;
keymap = device->keymap;
direction = gdk_keymap_get_direction (keymap);
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
+ modifiers = device->key_modifiers;
device->key_modifiers = mods_depressed | mods_latched | mods_locked;
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
+ toggle_keys_apply (device, modifiers, device->key_modifiers);
+
g_signal_emit_by_name (keymap, "state-changed");
if (direction != gdk_keymap_get_direction (keymap))
g_signal_emit_by_name (keymap, "direction-changed");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]