seat-impl: Split initialization in two steps

First instantiate the object, and set the instance pointer in
MetaSeatNative, then initialize it. This is needed due to initializing
libinput may create virtual input devices used for accessibility
features, such as mouse keys, and for this it needs to fetch the
MetaSeatImpl from MetaSeatNative.

Fixes: 5fc60eac ("seat-impl: Keep track of virtual input devices too")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3708
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4374>
This commit is contained in:
Jonas Ådahl 2025-03-27 23:55:06 +01:00 committed by Bruce Leidl
parent d8a12d1667
commit 136c0037cc
3 changed files with 14 additions and 6 deletions

View File

@ -3985,12 +3985,17 @@ meta_seat_impl_new (MetaSeatNative *seat_native,
const char *seat_id,
MetaSeatNativeFlag flags)
{
return g_initable_new (META_TYPE_SEAT_IMPL,
NULL, NULL,
"seat", seat_native,
"seat-id", seat_id,
"flags", flags,
NULL);
return g_object_new (META_TYPE_SEAT_IMPL,
"seat", seat_native,
"seat-id", seat_id,
"flags", flags,
NULL);
}
void
meta_seat_impl_setup (MetaSeatImpl *seat_impl)
{
g_initable_init (G_INITABLE (seat_impl), NULL, NULL);
}
static gboolean

View File

@ -127,6 +127,8 @@ MetaSeatImpl * meta_seat_impl_new (MetaSeatNative *seat_native,
const char *seat_id,
MetaSeatNativeFlag flags);
void meta_seat_impl_setup (MetaSeatImpl *seat_impl);
void meta_seat_impl_start (MetaSeatImpl *seat_impl);
void meta_seat_impl_destroy (MetaSeatImpl *seat_impl);

View File

@ -143,6 +143,7 @@ meta_seat_native_constructed (GObject *object)
MetaSeatNative *seat = META_SEAT_NATIVE (object);
seat->impl = meta_seat_impl_new (seat, seat->seat_id, seat->flags);
meta_seat_impl_setup (seat->impl);
g_signal_connect (seat->impl, "kbd-a11y-flags-changed",
G_CALLBACK (proxy_kbd_a11y_flags_changed), seat);
g_signal_connect (seat->impl, "kbd-a11y-mods-state-changed",