[mutter/wip/carlosg/input-thread: 61/101] backends/native: Forward keyboard a11y changes via the MetaSeatImpl
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 61/101] backends/native: Forward keyboard a11y changes via the MetaSeatImpl
- Date: Wed, 25 Nov 2020 17:12:07 +0000 (UTC)
commit f0f5fdc88f76e115b178510f186d6597c381c151
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 11 17:11:51 2020 +0200
backends/native: Forward keyboard a11y changes via the MetaSeatImpl
These changes will happen in the input event management code, so let them
be emitted via the MetaSeatImpl, as that's what we'll have neat access to.
The ClutterSeat signals are now emitted from there.
src/backends/native/meta-input-device-native.c | 30 ++++++++----------
src/backends/native/meta-seat-impl.c | 42 ++++++++++++++++++++++++++
src/backends/native/meta-seat-impl.h | 8 +++++
src/backends/native/meta-seat-native.c | 27 +++++++++++++++++
4 files changed, 90 insertions(+), 17 deletions(-)
---
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index ec41afc08c..b9f3d36fee 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -27,7 +27,7 @@
#include "backends/meta-backend-private.h"
#include "backends/native/meta-input-device-tool-native.h"
#include "backends/native/meta-input-device-native.h"
-#include "backends/native/meta-seat-native.h"
+#include "backends/native/meta-seat-impl.h"
#include "clutter/clutter-mutter.h"
G_DEFINE_TYPE (MetaInputDeviceNative,
@@ -416,10 +416,9 @@ key_event_is_modifier (ClutterEvent *event)
static void
notify_stickykeys_mask (MetaInputDeviceNative *device)
{
- g_signal_emit_by_name (device->seat_impl->seat_native,
- "kbd-a11y-mods-state-changed",
- device->stickykeys_latched_mask,
- device->stickykeys_locked_mask);
+ meta_seat_impl_notify_kbd_a11y_mods_state_changed (device->seat_impl,
+ device->stickykeys_latched_mask,
+ device->stickykeys_locked_mask);
}
static void
@@ -492,10 +491,9 @@ notify_stickykeys_change (MetaInputDeviceNative *device)
device->stickykeys_depressed_mask = 0;
update_internal_xkb_state (device, 0, 0);
- g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
- "kbd-a11y-flags-changed",
- device->a11y_flags,
- META_A11Y_STICKY_KEYS_ENABLED);
+ meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
+ device->a11y_flags,
+ META_A11Y_STICKY_KEYS_ENABLED);
}
static void
@@ -525,10 +523,9 @@ set_slowkeys_off (MetaInputDeviceNative *device)
{
device->a11y_flags &= ~META_A11Y_SLOW_KEYS_ENABLED;
- g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
- "kbd-a11y-flags-changed",
- device->a11y_flags,
- META_A11Y_SLOW_KEYS_ENABLED);
+ meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
+ device->a11y_flags,
+ META_A11Y_SLOW_KEYS_ENABLED);
}
static void
@@ -536,10 +533,9 @@ set_slowkeys_on (MetaInputDeviceNative *device)
{
device->a11y_flags |= META_A11Y_SLOW_KEYS_ENABLED;
- g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
- "kbd-a11y-flags-changed",
- device->a11y_flags,
- META_A11Y_SLOW_KEYS_ENABLED);
+ meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
+ device->a11y_flags,
+ META_A11Y_SLOW_KEYS_ENABLED);
}
static void
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index f3eb6efe11..a8ee3fc2a6 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -106,6 +106,15 @@ enum
static GParamSpec *props[N_PROPS] = { NULL };
+enum
+{
+ KBD_A11Y_FLAGS_CHANGED,
+ KBD_A11Y_MODS_STATE_CHANGED,
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0 };
+
G_DEFINE_TYPE (MetaSeatImpl, meta_seat_impl, G_TYPE_OBJECT)
static void process_events (MetaSeatImpl *seat_impl);
@@ -2700,6 +2709,21 @@ meta_seat_impl_class_init (MetaSeatImplClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
+ signals[KBD_A11Y_FLAGS_CHANGED] =
+ g_signal_new ("kbd-a11y-flags-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 2,
+ G_TYPE_UINT, G_TYPE_UINT);
+ signals[KBD_A11Y_MODS_STATE_CHANGED] =
+ g_signal_new ("kbd-a11y-mods-state-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 2,
+ G_TYPE_UINT, G_TYPE_UINT);
+
g_object_class_install_properties (object_class, N_PROPS, props);
}
@@ -3020,3 +3044,21 @@ meta_seat_impl_new (MetaSeatNative *seat_native,
"seat-id", seat_id,
NULL);
}
+
+void
+meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
+ MetaKeyboardA11yFlags new_flags,
+ MetaKeyboardA11yFlags what_changed)
+{
+ g_signal_emit (seat_impl, signals[KBD_A11Y_FLAGS_CHANGED], 0,
+ new_flags, what_changed);
+}
+
+void
+meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
+ xkb_mod_mask_t new_latched_mods,
+ xkb_mod_mask_t new_locked_mods)
+{
+ g_signal_emit (seat_impl, signals[KBD_A11Y_MODS_STATE_CHANGED], 0,
+ new_latched_mods, new_locked_mods);
+}
diff --git a/src/backends/native/meta-seat-impl.h b/src/backends/native/meta-seat-impl.h
index 71241cbc73..8d64399211 100644
--- a/src/backends/native/meta-seat-impl.h
+++ b/src/backends/native/meta-seat-impl.h
@@ -27,6 +27,7 @@
#include <libinput.h>
#include <linux/input-event-codes.h>
+#include "backends/meta-input-settings-private.h"
#include "backends/meta-viewport-info.h"
#include "backends/native/meta-backend-native-types.h"
#include "backends/native/meta-barrier-native.h"
@@ -239,4 +240,11 @@ GSList * meta_seat_impl_get_devices (MetaSeatImpl *seat_impl);
MetaKeymapNative * meta_seat_impl_get_keymap (MetaSeatImpl *seat_impl);
+void meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
+ MetaKeyboardA11yFlags new_flags,
+ MetaKeyboardA11yFlags what_changed);
+void meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
+ xkb_mod_mask_t new_latched_mods,
+ xkb_mod_mask_t new_locked_mods);
+
#endif /* META_SEAT_IMPL_H */
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 73500ecc0a..0e536ee0d3 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -107,12 +107,39 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
return FALSE;
}
+static void
+proxy_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
+ MetaKeyboardA11yFlags new_flags,
+ MetaKeyboardA11yFlags what_changed,
+ MetaSeatNative *seat_native)
+{
+ g_signal_emit_by_name (seat_native,
+ "kbd-a11y-flags-changed",
+ new_flags, what_changed);
+}
+
+static void
+proxy_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
+ xkb_mod_mask_t new_latched_mods,
+ xkb_mod_mask_t new_locked_mods,
+ MetaSeatNative *seat_native)
+{
+ g_signal_emit_by_name (seat_native,
+ "kbd-a11y-mods-state-changed",
+ new_latched_mods,
+ new_locked_mods);
+}
+
static void
meta_seat_native_constructed (GObject *object)
{
MetaSeatNative *seat = META_SEAT_NATIVE (object);
seat->impl = meta_seat_impl_new (seat, seat->seat_id);
+ g_signal_connect (seat->impl, "kbd-a11y-flags-changed",
+ G_CALLBACK (proxy_kbd_a11y_flags_changed), seat);
+ g_signal_connect (seat->impl, "kbd-a11y-mods-state-changed",
+ G_CALLBACK (proxy_kbd_a11y_mods_state_changed), seat);
seat->core_pointer = meta_seat_impl_get_pointer (seat->impl);
seat->core_keyboard = meta_seat_impl_get_keyboard (seat->impl);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]