From 89a140d6187c8d90bff76841cd8949f25fdcd95c Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 11 Aug 2020 17:38:32 +0200 Subject: [PATCH] backends/native: Proxy modifier state changes via MetaSeatImpl This changes within the MetaSeatImpl realm, so use a signal to forward this to the MetaSeatNative/MetaKeymapNative one. Part-of: --- src/backends/native/meta-seat-impl.c | 9 ++++++++- src/backends/native/meta-seat-native.c | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index 4aeb0d0c0..32773a478 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -112,6 +112,7 @@ enum KBD_A11Y_MODS_STATE_CHANGED, TOUCH_MODE, BELL, + MODS_STATE_CHANGED, N_SIGNALS }; @@ -343,7 +344,7 @@ meta_seat_impl_notify_key (MetaSeatImpl *seat_impl, { MetaInputDeviceNative *keyboard_native; - g_signal_emit_by_name (seat_impl->keymap, "state-changed"); + g_signal_emit (seat_impl, signals[MODS_STATE_CHANGED], 0); meta_seat_impl_sync_leds (seat_impl); keyboard_native = META_INPUT_DEVICE_NATIVE (seat_impl->core_keyboard); meta_input_device_native_a11y_maybe_notify_toggle_keys (keyboard_native); @@ -2738,6 +2739,12 @@ meta_seat_impl_class_init (MetaSeatImplClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0); + signals[MODS_STATE_CHANGED] = + g_signal_new ("mods-state-changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 0); g_object_class_install_properties (object_class, N_PROPS, props); } diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c index bad7c656f..00b3c36ba 100644 --- a/src/backends/native/meta-seat-native.c +++ b/src/backends/native/meta-seat-native.c @@ -140,6 +140,16 @@ proxy_bell (MetaSeatImpl *seat_impl, clutter_seat_bell_notify (CLUTTER_SEAT (seat_native)); } +static void +proxy_mods_state_changed (MetaSeatImpl *seat_impl, + ClutterSeat *seat) +{ + ClutterKeymap *keymap; + + keymap = clutter_seat_get_keymap (seat); + g_signal_emit_by_name (keymap, "state-changed"); +} + static void meta_seat_native_constructed (GObject *object) { @@ -154,6 +164,8 @@ meta_seat_native_constructed (GObject *object) G_CALLBACK (proxy_touch_mode_changed), seat); g_signal_connect (seat->impl, "bell", G_CALLBACK (proxy_bell), seat); + g_signal_connect (seat->impl, "mods-state-changed", + G_CALLBACK (proxy_mods_state_changed), seat); seat->core_pointer = meta_seat_impl_get_pointer (seat->impl); seat->core_keyboard = meta_seat_impl_get_keyboard (seat->impl);