[mutter/wip/carlosg/input-thread: 33/48] backends/native: Proxy modifier state changes via MetaSeatImpl




commit c6d0b2ac3e9b14a3e24b4e16af098653197c75af
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Aug 11 17:38:32 2020 +0200

    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.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 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 967f072491..06ae7d3aa1 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -111,6 +111,7 @@ enum
   KBD_A11Y_MODS_STATE_CHANGED,
   TOUCH_MODE,
   BELL,
+  MODS_STATE_CHANGED,
   N_SIGNALS
 };
 
@@ -346,7 +347,7 @@ meta_seat_impl_notify_key (MetaSeatImpl       *seat,
 
   if (update_keys && (changed_state & XKB_STATE_LEDS))
     {
-      g_signal_emit_by_name (seat->keymap, "state-changed");
+      g_signal_emit (seat, signals[MODS_STATE_CHANGED], 0);
       meta_seat_impl_sync_leds (seat);
       meta_input_device_native_a11y_maybe_notify_toggle_keys (META_INPUT_DEVICE_NATIVE 
(seat->core_keyboard));
     }
@@ -2747,6 +2748,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 a1e3ac55a1..37df1e13e2 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -144,6 +144,16 @@ proxy_bell (MetaSeatImpl   *impl,
   clutter_seat_bell_notify (CLUTTER_SEAT (seat_native));
 }
 
+static void
+proxy_mods_state_changed (MetaSeatImpl   *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)
 {
@@ -158,6 +168,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]