[PATCH libinput 07/19] touchpad: mark which events are currently pending processing

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 16 22:48:26 PST 2014


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 6 ++++++
 src/evdev-mt-touchpad.h | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 8a8586a..1d34df8 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -151,6 +151,7 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t)
 		t->state = TOUCH_BEGIN;
 		tp->nfingers_down++;
 		assert(tp->nfingers_down >= 1);
+		tp->queued |= TOUCHPAD_EVENT_MOTION;
 	}
 }
 
@@ -164,6 +165,7 @@ tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t)
 	t->state = TOUCH_END;
 	assert(tp->nfingers_down >= 1);
 	tp->nfingers_down--;
+	tp->queued |= TOUCHPAD_EVENT_MOTION;
 }
 
 static double
@@ -203,11 +205,13 @@ tp_process_absolute(struct tp_dispatch *tp,
 		t->x = e->value;
 		t->millis = time;
 		t->dirty = true;
+		tp->queued |= TOUCHPAD_EVENT_MOTION;
 		break;
 	case ABS_MT_POSITION_Y:
 		t->y = e->value;
 		t->millis = time;
 		t->dirty = true;
+		tp->queued |= TOUCHPAD_EVENT_MOTION;
 		break;
 	case ABS_MT_SLOT:
 		tp->slot = e->value;
@@ -270,6 +274,8 @@ tp_post_process_state(struct tp_dispatch *tp, uint32_t time)
 
 		t->dirty = false;
 	}
+
+	tp->queued = TOUCHPAD_EVENT_NONE;
 }
 
 static void
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index f7f413b..52ad3ab 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -31,6 +31,13 @@
 
 #define TOUCHPAD_HISTORY_LENGTH 4
 
+enum touchpad_event {
+	TOUCHPAD_EVENT_NONE		= 0,
+	TOUCHPAD_EVENT_MOTION		= (1 << 0),
+	TOUCHPAD_EVENT_BUTTON_PRESS	= (1 << 1),
+	TOUCHPAD_EVENT_BUTTON_RELEASE	= (1 << 2),
+};
+
 enum touch_state {
 	TOUCH_NONE = 0,
 	TOUCH_BEGIN,
@@ -83,6 +90,8 @@ struct tp_dispatch {
 		double min_factor;
 		double max_factor;
 	} accel;
+
+	enum touchpad_event queued;
 };
 
 #define tp_for_each_touch(_tp, _t) \
-- 
1.8.4.2



More information about the wayland-devel mailing list