Add libinput_next_event_type()

Returns the event type of the next event pending in the queue. For systems
that have the device init state separate from the actual event procesing
(read: xorg drivers) we need to be able to peek at the next event type to
check for the end of any initialization events (seat/device added) and the
beginning of actual device input events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2013-12-13 17:58:50 +10:00
parent 90fa77908b
commit 8eac85e3fb
2 changed files with 26 additions and 0 deletions

View file

@ -910,6 +910,18 @@ libinput_get_event(struct libinput *libinput)
return event;
}
LIBINPUT_EXPORT enum libinput_event_type
libinput_next_event_type(struct libinput *libinput)
{
struct libinput_event *event;
if (libinput->events_count == 0)
return LIBINPUT_EVENT_NONE;
event = libinput->events[libinput->events_out];
return event->type;
}
LIBINPUT_EXPORT void *
libinput_get_user_data(struct libinput *libinput)
{

View file

@ -488,6 +488,20 @@ libinput_dispatch(struct libinput *libinput);
struct libinput_event *
libinput_get_event(struct libinput *libinput);
/**
* @ingroup base
*
* Return the type of the next event in the internal queue. This function
* does not pop the event off the queue and the next call to
* libinput_get_event() returns that event.
*
* @param libinput A previously initialized libinput context
* @return The event type of the next available event or LIBINPUT_EVENT_NONE
* if no event is availble.
*/
enum libinput_event_type
libinput_next_event_type(struct libinput *libinput);
/**
* @ingroup base
*