Commit db3b6fe5 authored by Peter Hutterer's avatar Peter Hutterer

fallback: change to handle the state at EV_SYN time

The previous approach was to remember the last event and flush it at the right
time. The new approach is to update the device state during the frame and send
out the events at EV_SYN time.

This gives us two advantages: we are not dependent on the kernel order of how
events come in and we can process events depending on other events in the same
frame. This will come in handy later for button debouncing.

This is also the approach we have in the touchpad and tablet backends.

Two FIXMEs are left in place, the button debouncing code and the lid switch
code. Both need to be handled in future patches.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 8e86f289
This diff is collapsed.
......@@ -58,6 +58,7 @@ struct fallback_dispatch {
} mt;
struct device_coords rel;
struct device_coords wheel;
struct {
/* The struct for the tablet mode switch device itself */
......@@ -75,6 +76,7 @@ struct fallback_dispatch {
/* Bitmask of pressed keys used to ignore initial release events from
* the kernel. */
unsigned long hw_key_mask[NLONGS(KEY_CNT)];
unsigned long last_hw_key_mask[NLONGS(KEY_CNT)];
enum evdev_event_type pending_event;
......
......@@ -41,13 +41,14 @@
enum evdev_event_type {
EVDEV_NONE,
EVDEV_ABSOLUTE_TOUCH_DOWN,
EVDEV_ABSOLUTE_MOTION,
EVDEV_ABSOLUTE_TOUCH_UP,
EVDEV_ABSOLUTE_MT_DOWN,
EVDEV_ABSOLUTE_MT_MOTION,
EVDEV_ABSOLUTE_MT_UP,
EVDEV_RELATIVE_MOTION,
EVDEV_ABSOLUTE_TOUCH_DOWN = (1 << 0),
EVDEV_ABSOLUTE_MOTION = (1 << 1),
EVDEV_ABSOLUTE_TOUCH_UP = (1 << 2),
EVDEV_ABSOLUTE_MT= (1 << 3),
EVDEV_WHEEL = (1 << 4),
EVDEV_KEY = (1 << 5),
EVDEV_RELATIVE_MOTION = (1 << 6),
EVDEV_BUTTON = (1 << 7),
};
enum evdev_device_seat_capability {
......@@ -150,7 +151,16 @@ enum evdev_debounce_state {
DEBOUNCE_ACTIVE,
};
enum mt_slot_state {
SLOT_STATE_NONE,
SLOT_STATE_BEGIN,
SLOT_STATE_UPDATE,
SLOT_STATE_END,
};
struct mt_slot {
bool dirty;
enum mt_slot_state state;
int32_t seat_slot;
struct device_coords point;
struct device_coords hysteresis_center;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment