[PATCH libinput 01/24] Add LIBINPUT_EVENT_POINTER_AXIS_FRAME event

Carlos Garnacho carlosg at gnome.org
Mon Apr 21 10:11:10 PDT 2014


This event marks the end of 1..N simultaneous axis changes. Will be
useful to have users compress vscroll/hscroll processing in a single
point, and will prove even more useful on devices with a higher number
of axes, like tablets.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 src/libinput-private.h |  4 ++++
 src/libinput.c         | 23 +++++++++++++++++++++++
 src/libinput.h         |  5 +++++
 3 files changed, 32 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 21627b0..4eac89d 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -155,6 +155,10 @@ pointer_notify_axis(struct libinput_device *device,
 		    li_fixed_t value);
 
 void
+pointer_notify_axis_frame(struct libinput_device *device,
+			  uint32_t time);
+
+void
 touch_notify_touch_down(struct libinput_device *device,
 			uint32_t time,
 			int32_t slot,
diff --git a/src/libinput.c b/src/libinput.c
index 1e31be3..4ecd068 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -175,6 +175,7 @@ libinput_event_get_pointer_event(struct libinput_event *event)
 	case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
 	case LIBINPUT_EVENT_POINTER_BUTTON:
 	case LIBINPUT_EVENT_POINTER_AXIS:
+	case LIBINPUT_EVENT_POINTER_AXIS_FRAME:
 		return (struct libinput_event_pointer *) event;
 	case LIBINPUT_EVENT_TOUCH_DOWN:
 	case LIBINPUT_EVENT_TOUCH_UP:
@@ -202,6 +203,7 @@ libinput_event_get_keyboard_event(struct libinput_event *event)
 	case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
 	case LIBINPUT_EVENT_POINTER_BUTTON:
 	case LIBINPUT_EVENT_POINTER_AXIS:
+	case LIBINPUT_EVENT_POINTER_AXIS_FRAME:
 	case LIBINPUT_EVENT_TOUCH_DOWN:
 	case LIBINPUT_EVENT_TOUCH_UP:
 	case LIBINPUT_EVENT_TOUCH_MOTION:
@@ -226,6 +228,7 @@ libinput_event_get_touch_event(struct libinput_event *event)
 	case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
 	case LIBINPUT_EVENT_POINTER_BUTTON:
 	case LIBINPUT_EVENT_POINTER_AXIS:
+	case LIBINPUT_EVENT_POINTER_AXIS_FRAME:
 		break;
 	case LIBINPUT_EVENT_TOUCH_DOWN:
 	case LIBINPUT_EVENT_TOUCH_UP:
@@ -252,6 +255,7 @@ libinput_event_get_device_notify_event(struct libinput_event *event)
 	case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
 	case LIBINPUT_EVENT_POINTER_BUTTON:
 	case LIBINPUT_EVENT_POINTER_AXIS:
+	case LIBINPUT_EVENT_POINTER_AXIS_FRAME:
 	case LIBINPUT_EVENT_TOUCH_DOWN:
 	case LIBINPUT_EVENT_TOUCH_UP:
 	case LIBINPUT_EVENT_TOUCH_MOTION:
@@ -844,6 +848,25 @@ pointer_notify_axis(struct libinput_device *device,
 }
 
 void
+pointer_notify_axis_frame(struct libinput_device *device,
+			  uint32_t time)
+{
+	struct libinput_event_pointer *axis_frame_event;
+
+	axis_frame_event = zalloc(sizeof *axis_frame_event);
+	if (!axis_frame_event)
+		return;
+
+	*axis_frame_event = (struct libinput_event_pointer) {
+		.time = time,
+	};
+
+	post_device_event(device,
+			  LIBINPUT_EVENT_POINTER_AXIS_FRAME,
+			  &axis_frame_event->base);
+}
+
+void
 touch_notify_touch_down(struct libinput_device *device,
 			uint32_t time,
 			int32_t slot,
diff --git a/src/libinput.h b/src/libinput.h
index 810a66c..5b3d79e 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -146,6 +146,11 @@ enum libinput_event_type {
 	LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE,
 	LIBINPUT_EVENT_POINTER_BUTTON,
 	LIBINPUT_EVENT_POINTER_AXIS,
+	/**
+	 * Signals the end of a set of axis changes on the pointer. This
+	 * event has no coordinate information attached.
+	 */
+	LIBINPUT_EVENT_POINTER_AXIS_FRAME,
 
 	LIBINPUT_EVENT_TOUCH_DOWN = 500,
 	LIBINPUT_EVENT_TOUCH_UP,
-- 
1.9.0



More information about the wayland-devel mailing list