mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
backends/native: Shuffle keyboard a11y 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. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
parent
7547891a76
commit
ceefa72ade
@ -74,7 +74,6 @@ struct _MetaBackendNative
|
|||||||
MetaLauncher *launcher;
|
MetaLauncher *launcher;
|
||||||
MetaUdev *udev;
|
MetaUdev *udev;
|
||||||
MetaKms *kms;
|
MetaKms *kms;
|
||||||
MetaInputSettings *input_settings;
|
|
||||||
|
|
||||||
gulong udev_device_added_handler_id;
|
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->udev);
|
||||||
g_clear_object (&native->kms);
|
g_clear_object (&native->kms);
|
||||||
meta_launcher_free (native->launcher);
|
meta_launcher_free (native->launcher);
|
||||||
g_clear_object (&native->input_settings);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -163,33 +161,10 @@ update_viewports (MetaBackend *backend)
|
|||||||
g_object_unref (viewports);
|
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
|
static void
|
||||||
meta_backend_native_post_init (MetaBackend *backend)
|
meta_backend_native_post_init (MetaBackend *backend)
|
||||||
{
|
{
|
||||||
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
|
||||||
MetaSettings *settings = meta_backend_get_settings (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);
|
META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
|
||||||
|
|
||||||
@ -261,9 +236,11 @@ meta_backend_native_create_renderer (MetaBackend *backend,
|
|||||||
static MetaInputSettings *
|
static MetaInputSettings *
|
||||||
meta_backend_native_get_input_settings (MetaBackend *backend)
|
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 *
|
static MetaLogicalMonitor *
|
||||||
@ -667,6 +644,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
|
|||||||
MetaSeatNative *seat =
|
MetaSeatNative *seat =
|
||||||
META_SEAT_NATIVE (clutter_backend_get_default_seat (clutter_backend));
|
META_SEAT_NATIVE (clutter_backend_get_default_seat (clutter_backend));
|
||||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||||
|
MetaInputSettings *input_settings;
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (MetaBackendNativeResume,
|
COGL_TRACE_BEGIN_SCOPED (MetaBackendNativeResume,
|
||||||
"Backend (resume)");
|
"Backend (resume)");
|
||||||
@ -683,7 +661,8 @@ void meta_backend_native_resume (MetaBackendNative *native)
|
|||||||
idle_monitor = meta_idle_monitor_get_core ();
|
idle_monitor = meta_idle_monitor_get_core ();
|
||||||
meta_idle_monitor_reset_idletime (idle_monitor);
|
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));
|
clutter_seat_ensure_a11y_state (CLUTTER_SEAT (seat));
|
||||||
}
|
}
|
||||||
|
@ -2476,6 +2476,17 @@ static const struct libinput_interface libinput_interface = {
|
|||||||
close_restricted
|
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
|
static void
|
||||||
meta_seat_impl_set_keyboard_numlock (MetaSeatImpl *seat_impl,
|
meta_seat_impl_set_keyboard_numlock (MetaSeatImpl *seat_impl,
|
||||||
gboolean numlock_state)
|
gboolean numlock_state)
|
||||||
@ -2568,6 +2579,8 @@ meta_seat_impl_constructed (GObject *object)
|
|||||||
udev_unref (udev);
|
udev_unref (udev);
|
||||||
|
|
||||||
seat_impl->input_settings = meta_input_settings_native_new (seat_impl);
|
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 });
|
seat_impl->udev_client = g_udev_client_new ((const char *[]) { "input", NULL });
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user