[PATCH libinput 1/3] tablet: add missing event type checks for tablet events

Peter Hutterer peter.hutterer at who-t.net
Sun Nov 15 15:31:39 PST 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/libinput.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/src/libinput.c b/src/libinput.c
index c47f9fc..ed9490f 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1064,48 +1064,97 @@ libinput_event_tablet_get_y_transformed(struct libinput_event_tablet *event,
 LIBINPUT_EXPORT struct libinput_tool *
 libinput_event_tablet_get_tool(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_AXIS,
+			   LIBINPUT_EVENT_TABLET_TIP,
+			   LIBINPUT_EVENT_TABLET_BUTTON,
+			   LIBINPUT_EVENT_TABLET_PROXIMITY);
+
 	return event->tool;
 }
 
 LIBINPUT_EXPORT enum libinput_tool_proximity_state
 libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_PROXIMITY);
+
 	return event->proximity_state;
 }
 
 LIBINPUT_EXPORT enum libinput_tool_tip_state
 libinput_event_tablet_get_tip_state(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_TIP);
+
 	return event->tip_state;
 }
 
 LIBINPUT_EXPORT uint32_t
 libinput_event_tablet_get_time(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_AXIS,
+			   LIBINPUT_EVENT_TABLET_TIP,
+			   LIBINPUT_EVENT_TABLET_BUTTON,
+			   LIBINPUT_EVENT_TABLET_PROXIMITY);
+
 	return us2ms(event->time);
 }
 
 LIBINPUT_EXPORT uint64_t
 libinput_event_tablet_get_time_usec(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_AXIS,
+			   LIBINPUT_EVENT_TABLET_TIP,
+			   LIBINPUT_EVENT_TABLET_BUTTON,
+			   LIBINPUT_EVENT_TABLET_PROXIMITY);
+
 	return event->time;
 }
 
 LIBINPUT_EXPORT uint32_t
 libinput_event_tablet_get_button(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_BUTTON);
+
 	return event->button;
 }
 
 LIBINPUT_EXPORT enum libinput_button_state
 libinput_event_tablet_get_button_state(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_BUTTON);
+
 	return event->state;
 }
 
 LIBINPUT_EXPORT uint32_t
 libinput_event_tablet_get_seat_button_count(struct libinput_event_tablet *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   0,
+			   LIBINPUT_EVENT_TABLET_BUTTON);
+
 	return event->seat_button_count;
 }
 
-- 
2.4.3



More information about the wayland-devel mailing list