mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
seat-impl: Dispatch source also when there are already queued events
Libinput will queue a few initial events when a seat is assigned to the udev backend; a result of it probing udev adding detected devices. For us to see these events, we need to dispatch libinput before going idle, as nothing will show up on the libinput file descriptor until something else (e.g. keyboard event or mouse movement) wakes us up. Do this by adding a prepare() function to the libinput GSource, that checks whether there are any events in the queue already, and return TRUE if so is the case, causing us to dispatch before going fully idle. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1688>
This commit is contained in:
parent
9b5fb1b593
commit
e6b70f1a2b
@ -943,6 +943,25 @@ meta_seat_impl_notify_touch_event_in_impl (MetaSeatImpl *seat_impl,
|
||||
/*
|
||||
* MetaEventSource for reading input devices
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
meta_event_prepare (GSource *g_source,
|
||||
int *timeout_ms)
|
||||
{
|
||||
MetaEventSource *source = (MetaEventSource *) g_source;
|
||||
MetaSeatImpl *seat_impl = source->seat_impl;
|
||||
|
||||
*timeout_ms = -1;
|
||||
|
||||
switch (libinput_next_event_type (seat_impl->libinput))
|
||||
{
|
||||
case LIBINPUT_EVENT_NONE:
|
||||
return FALSE;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_event_check (GSource *source)
|
||||
{
|
||||
@ -1429,7 +1448,7 @@ meta_event_dispatch (GSource *g_source,
|
||||
}
|
||||
|
||||
static GSourceFuncs event_funcs = {
|
||||
NULL,
|
||||
meta_event_prepare,
|
||||
meta_event_check,
|
||||
meta_event_dispatch,
|
||||
NULL
|
||||
|
Loading…
Reference in New Issue
Block a user