touchpad: mark which events are currently pending processing
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 7 Feb 2014 03:48:06 +0000 (13:48 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 24 Mar 2014 04:56:40 +0000 (14:56 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h

index 8a8586a..1d34df8 100644 (file)
@@ -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
index f7f413b..52ad3ab 100644 (file)
 
 #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) \