mirror of
https://github.com/brl/mutter.git
synced 2025-01-12 20:52:37 +00:00
seat/native/impl: Start reading input device events when starting
This opens up for a possibility to handle initial events (devices discovered on startup) during initialization, meaning we can figure out a more correct initial state that depends on available input devices. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
This commit is contained in:
parent
af078264fa
commit
27606cf1fb
@ -756,6 +756,17 @@ init_gpus (MetaBackendNative *native,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_started (MetaContext *context,
|
||||||
|
MetaBackend *backend)
|
||||||
|
{
|
||||||
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
|
ClutterSeat *seat;
|
||||||
|
|
||||||
|
seat = clutter_backend_get_default_seat (clutter_backend);
|
||||||
|
meta_seat_native_start (META_SEAT_NATIVE (seat));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
meta_backend_native_initable_init (GInitable *initable,
|
meta_backend_native_initable_init (GInitable *initable,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@ -804,6 +815,11 @@ meta_backend_native_initable_init (GInitable *initable,
|
|||||||
if (!init_gpus (native, error))
|
if (!init_gpus (native, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
g_signal_connect (meta_backend_get_context (backend),
|
||||||
|
"started",
|
||||||
|
G_CALLBACK (on_started),
|
||||||
|
backend);
|
||||||
|
|
||||||
return initable_parent_iface->init (initable, cancellable, error);
|
return initable_parent_iface->init (initable, cancellable, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2809,7 +2809,6 @@ static gboolean
|
|||||||
init_libinput (MetaSeatImpl *seat_impl,
|
init_libinput (MetaSeatImpl *seat_impl,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaEventSource *source;
|
|
||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
struct libinput *libinput;
|
struct libinput *libinput;
|
||||||
|
|
||||||
@ -2841,12 +2840,19 @@ init_libinput (MetaSeatImpl *seat_impl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
seat_impl->libinput = libinput;
|
seat_impl->libinput = libinput;
|
||||||
source = meta_event_source_new (seat_impl);
|
|
||||||
seat_impl->event_source = source;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_libinput_source (MetaSeatImpl *seat_impl)
|
||||||
|
{
|
||||||
|
MetaEventSource *source;
|
||||||
|
|
||||||
|
source = meta_event_source_new (seat_impl);
|
||||||
|
seat_impl->event_source = source;
|
||||||
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
input_thread (MetaSeatImpl *seat_impl)
|
input_thread (MetaSeatImpl *seat_impl)
|
||||||
{
|
{
|
||||||
@ -3773,6 +3779,32 @@ meta_seat_impl_new (MetaSeatNative *seat_native,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
start_in_impl (GTask *task)
|
||||||
|
{
|
||||||
|
MetaSeatImpl *seat_impl = g_task_get_source_object (task);
|
||||||
|
|
||||||
|
if (seat_impl->libinput)
|
||||||
|
init_libinput_source (seat_impl);
|
||||||
|
|
||||||
|
g_task_return_boolean (task, TRUE);
|
||||||
|
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_seat_impl_start (MetaSeatImpl *seat_impl)
|
||||||
|
{
|
||||||
|
GTask *task;
|
||||||
|
|
||||||
|
g_return_if_fail (META_IS_SEAT_IMPL (seat_impl));
|
||||||
|
|
||||||
|
task = g_task_new (seat_impl, NULL, NULL, NULL);
|
||||||
|
meta_seat_impl_run_input_task (seat_impl, task,
|
||||||
|
(GSourceFunc) start_in_impl);
|
||||||
|
g_object_unref (task);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_seat_impl_notify_kbd_a11y_flags_changed_in_impl (MetaSeatImpl *seat_impl,
|
meta_seat_impl_notify_kbd_a11y_flags_changed_in_impl (MetaSeatImpl *seat_impl,
|
||||||
MetaKeyboardA11yFlags new_flags,
|
MetaKeyboardA11yFlags new_flags,
|
||||||
|
@ -131,6 +131,8 @@ MetaSeatImpl * meta_seat_impl_new (MetaSeatNative *seat_native,
|
|||||||
const char *seat_id,
|
const char *seat_id,
|
||||||
MetaSeatNativeFlag flags);
|
MetaSeatNativeFlag flags);
|
||||||
|
|
||||||
|
void meta_seat_impl_start (MetaSeatImpl *seat_impl);
|
||||||
|
|
||||||
void meta_seat_impl_destroy (MetaSeatImpl *seat_impl);
|
void meta_seat_impl_destroy (MetaSeatImpl *seat_impl);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
|
@ -425,6 +425,12 @@ meta_seat_native_init (MetaSeatNative *seat)
|
|||||||
seat->reserved_virtual_slots = g_hash_table_new (NULL, NULL);
|
seat->reserved_virtual_slots = g_hash_table_new (NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_seat_native_start (MetaSeatNative *seat_native)
|
||||||
|
{
|
||||||
|
meta_seat_impl_start (seat_native->impl);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_seat_native_release_devices:
|
* meta_seat_native_release_devices:
|
||||||
*
|
*
|
||||||
|
@ -71,6 +71,8 @@ META_EXPORT_TEST
|
|||||||
G_DECLARE_FINAL_TYPE (MetaSeatNative, meta_seat_native,
|
G_DECLARE_FINAL_TYPE (MetaSeatNative, meta_seat_native,
|
||||||
META, SEAT_NATIVE, ClutterSeat)
|
META, SEAT_NATIVE, ClutterSeat)
|
||||||
|
|
||||||
|
void meta_seat_native_start (MetaSeatNative *seat_native);
|
||||||
|
|
||||||
void meta_seat_native_set_libinput_seat (MetaSeatNative *seat,
|
void meta_seat_native_set_libinput_seat (MetaSeatNative *seat,
|
||||||
struct libinput_seat *libinput_seat);
|
struct libinput_seat *libinput_seat);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user