From: Peter Hutterer Date: Fri, 13 Dec 2013 07:49:38 +0000 (+1000) Subject: Add LIBEVENT_EVENT_NONE X-Git-Tag: 0.1.0~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90fa77908bb6254acc819ec1f7b49613edf413d5;p=platform%2Fupstream%2Flibinput.git 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 --- diff --git a/src/libinput.c b/src/libinput.c index d3aca8b9..713593e4 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -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: diff --git a/src/libinput.h b/src/libinput.h index bb4f950c..586d0f48 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -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,