[mutter/wip/carlosg/input-thread: 78/86] backends/native: Shuffle signal connection into MetaSeatImpl
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 78/86] backends/native: Shuffle signal connection into MetaSeatImpl
- Date: Sun, 22 Nov 2020 17:34:05 +0000 (UTC)
commit f7af400431f8f1a607b816bb82d3750c5baccef5
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Nov 21 12:52:45 2020 +0100
backends/native: Shuffle signal connection into MetaSeatImpl
This signal gets emitted in the input thread, and does things that
belong to it. Make it clear by moving to the MetaSeatImpl.
src/backends/native/meta-backend-native.c | 35 +++++++------------------------
src/backends/native/meta-seat-impl.c | 13 ++++++++++++
2 files changed, 20 insertions(+), 28 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index c5aaa42d47..5e63443126 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -74,7 +74,6 @@ struct _MetaBackendNative
MetaLauncher *launcher;
MetaUdev *udev;
MetaKms *kms;
- MetaInputSettings *input_settings;
gulong udev_device_added_handler_id;
};
@@ -102,7 +101,6 @@ meta_backend_native_finalize (GObject *object)
g_clear_object (&native->udev);
g_clear_object (&native->kms);
meta_launcher_free (native->launcher);
- g_clear_object (&native->input_settings);
G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object);
}
@@ -163,33 +161,10 @@ update_viewports (MetaBackend *backend)
g_object_unref (viewports);
}
-static void
-kbd_a11y_changed_cb (MetaInputSettings *input_settings,
- MetaKbdA11ySettings *a11y_settings,
- MetaBackend *backend)
-{
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
- ClutterInputDevice *device;
-
- device = clutter_seat_get_keyboard (seat);
- if (device)
- meta_input_device_native_apply_kbd_a11y_settings (META_INPUT_DEVICE_NATIVE (device),
- a11y_settings);
-}
-
static void
meta_backend_native_post_init (MetaBackend *backend)
{
- MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
MetaSettings *settings = meta_backend_get_settings (backend);
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- MetaSeatNative *seat =
- META_SEAT_NATIVE (clutter_backend_get_default_seat (clutter_backend));
-
- backend_native->input_settings = meta_seat_impl_get_input_settings (seat->impl);
- g_signal_connect_object (backend_native->input_settings, "kbd-a11y-changed",
- G_CALLBACK (kbd_a11y_changed_cb), backend, 0);
META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
@@ -261,9 +236,11 @@ meta_backend_native_create_renderer (MetaBackend *backend,
static MetaInputSettings *
meta_backend_native_get_input_settings (MetaBackend *backend)
{
- MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
+ ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
+ MetaSeatNative *seat_native =
+ META_SEAT_NATIVE (clutter_backend_get_default_seat (clutter_backend));
- return backend_native->input_settings;
+ return meta_seat_impl_get_input_settings (seat_native->impl);
}
static MetaLogicalMonitor *
@@ -680,6 +657,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
MetaSeatNative *seat =
META_SEAT_NATIVE (clutter_backend_get_default_seat (clutter_backend));
MetaRenderer *renderer = meta_backend_get_renderer (backend);
+ MetaInputSettings *input_settings;
COGL_TRACE_BEGIN_SCOPED (MetaBackendNativeResume,
"Backend (resume)");
@@ -696,7 +674,8 @@ void meta_backend_native_resume (MetaBackendNative *native)
idle_monitor = meta_idle_monitor_get_core ();
meta_idle_monitor_reset_idletime (idle_monitor);
- meta_input_settings_maybe_restore_numlock_state (native->input_settings);
+ input_settings = meta_backend_get_input_settings (backend);
+ meta_input_settings_maybe_restore_numlock_state (input_settings);
clutter_seat_ensure_a11y_state (CLUTTER_SEAT (seat));
}
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index a075056a73..206ab519af 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -2466,6 +2466,17 @@ static const struct libinput_interface libinput_interface = {
close_restricted
};
+static void
+kbd_a11y_changed_cb (MetaInputSettings *input_settings,
+ MetaKbdA11ySettings *a11y_settings,
+ MetaSeatImpl *seat_impl)
+{
+ MetaInputDeviceNative *keyboard;
+
+ keyboard = META_INPUT_DEVICE_NATIVE (seat_impl->core_keyboard);
+ meta_input_device_native_apply_kbd_a11y_settings (keyboard, a11y_settings);
+}
+
static void
meta_seat_impl_constructed (GObject *object)
{
@@ -2516,6 +2527,8 @@ meta_seat_impl_constructed (GObject *object)
udev_unref (udev);
seat_impl->input_settings = meta_input_settings_native_new (seat_impl);
+ g_signal_connect_object (seat_impl->input_settings, "kbd-a11y-changed",
+ G_CALLBACK (kbd_a11y_changed_cb), seat_impl, 0);
seat_impl->udev_client = g_udev_client_new ((const char *[]) { "input", NULL });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]