Add LIBEVENT_EVENT_NONE

This event type is needed to notify callers that there is currently no
event waiting (in a follow-up patch). Also, it it avoids true/false
inconsistencies on event types (LIBINPUT_EVENT_ADDED_SEAT would otherwise be
the only FALSE event). While that's not technically necessary, it may prevent
the odd bug further down the road.

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

View file

@ -35,6 +35,7 @@
#include "evdev.h"
enum libinput_event_class {
LIBINPUT_EVENT_CLASS_NONE,
LIBINPUT_EVENT_CLASS_BASE,
LIBINPUT_EVENT_CLASS_SEAT,
LIBINPUT_EVENT_CLASS_DEVICE,
@ -418,6 +419,9 @@ static enum libinput_event_class
libinput_event_get_class(struct libinput_event *event)
{
switch (event->type) {
case LIBINPUT_EVENT_NONE:
return LIBINPUT_EVENT_CLASS_NONE;
case LIBINPUT_EVENT_ADDED_SEAT:
case LIBINPUT_EVENT_REMOVED_SEAT:
case LIBINPUT_EVENT_ADDED_DEVICE:
@ -444,6 +448,7 @@ libinput_event_destroy(struct libinput_event *event)
return;
switch (libinput_event_get_class(event)) {
case LIBINPUT_EVENT_CLASS_NONE:
case LIBINPUT_EVENT_CLASS_BASE:
break;
case LIBINPUT_EVENT_CLASS_SEAT:
@ -873,6 +878,7 @@ libinput_post_event(struct libinput *libinput,
}
switch (libinput_event_get_class(event)) {
case LIBINPUT_EVENT_CLASS_NONE:
case LIBINPUT_EVENT_CLASS_BASE:
break;
case LIBINPUT_EVENT_CLASS_SEAT:

View file

@ -123,7 +123,8 @@ enum libinput_touch_type {
* Event type for events returned by libinput_get_event().
*/
enum libinput_event_type {
LIBINPUT_EVENT_ADDED_SEAT = 0,
LIBINPUT_EVENT_NONE = 0,
LIBINPUT_EVENT_ADDED_SEAT,
LIBINPUT_EVENT_REMOVED_SEAT,
LIBINPUT_EVENT_ADDED_DEVICE,
LIBINPUT_EVENT_REMOVED_DEVICE,