backend: Dispatch initial burst of events synchronously on init

This will consist of device-added events, meaning before init finishes,
we can derive some state that depends on the set of input devices
available on startup, such as cursor visibility.

This avoids cursor visibility switching between hidden and visibility
during startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
This commit is contained in:
Jonas Ådahl
2023-06-12 16:46:33 +02:00
committed by Marge Bot
parent 27606cf1fb
commit 49e6ce459c
3 changed files with 64 additions and 25 deletions

View File

@ -2841,6 +2841,8 @@ init_libinput (MetaSeatImpl *seat_impl,
seat_impl->libinput = libinput;
process_events (seat_impl);
return TRUE;
}
@ -2877,18 +2879,6 @@ input_thread (MetaSeatImpl *seat_impl)
NULL,
(GDestroyNotify) meta_device_file_release);
if (!(seat_impl->flags & META_SEAT_NATIVE_FLAG_NO_LIBINPUT))
{
g_autoptr (GError) error = NULL;
if (!init_libinput (seat_impl, &error))
{
g_critical ("Failed to initialize seat: %s", error->message);
seat_impl->input_thread_initialized = TRUE;
return NULL;
}
}
seat_impl->input_settings = meta_input_settings_native_new_in_impl (seat_impl);
g_signal_connect_object (seat_impl->input_settings, "kbd-a11y-changed",
G_CALLBACK (kbd_a11y_changed_cb), seat_impl, 0);
@ -2912,6 +2902,18 @@ input_thread (MetaSeatImpl *seat_impl)
if (meta_input_settings_maybe_restore_numlock_state (seat_impl->input_settings))
meta_seat_impl_set_keyboard_numlock_in_impl (seat_impl, TRUE);
if (!(seat_impl->flags & META_SEAT_NATIVE_FLAG_NO_LIBINPUT))
{
g_autoptr (GError) error = NULL;
if (!init_libinput (seat_impl, &error))
{
g_critical ("Failed to initialize seat: %s", error->message);
seat_impl->input_thread_initialized = TRUE;
return NULL;
}
}
seat_impl->has_touchscreen = has_touchscreen (seat_impl);
seat_impl->has_tablet_switch = has_tablet_switch (seat_impl);
update_touch_mode (seat_impl);