diff --git a/src/libei.c b/src/libei.c index 5885b3a..c5a7f5c 100644 --- a/src/libei.c +++ b/src/libei.c @@ -215,18 +215,15 @@ queue_event(struct ei *ei, struct ei_event *event) case EI_EVENT_TOUCH_UP: case EI_EVENT_TOUCH_MOTION: device->queue_frame_event = true; - log_debug(ei, "here\n"); break; case EI_EVENT_FRAME: /* silently discard empty frames */ if (!device->queue_frame_event) return; - log_debug(ei, "queue frame\n"); device->queue_frame_event = false; break; default: - log_debug(ei, "other: %s\n", ei_event_type_to_string(event->type)); if (device) { if (device->queue_frame_event) ei_queue_frame_event(device); diff --git a/src/libeis-private.h b/src/libeis-private.h index 94ec6ed..154a53f 100644 --- a/src/libeis-private.h +++ b/src/libeis-private.h @@ -143,6 +143,7 @@ struct eis_device { struct eis_keymap *keymap; bool send_frame_event; + bool queue_frame_event; struct { bool x_is_stopped, y_is_stopped; diff --git a/src/libeis.c b/src/libeis.c index af47e60..a224e7e 100644 --- a/src/libeis.c +++ b/src/libeis.c @@ -138,6 +138,37 @@ static void eis_queue_event(struct eis_event *event) { struct eis *eis = eis_event_get_context(event); + struct eis_device *device = eis_event_get_device(event); + + switch (event->type) { + case EIS_EVENT_POINTER_MOTION: + case EIS_EVENT_POINTER_MOTION_ABSOLUTE: + case EIS_EVENT_POINTER_BUTTON: + case EIS_EVENT_POINTER_SCROLL: + case EIS_EVENT_POINTER_SCROLL_STOP: + case EIS_EVENT_POINTER_SCROLL_CANCEL: + case EIS_EVENT_POINTER_SCROLL_DISCRETE: + case EIS_EVENT_KEYBOARD_KEY: + case EIS_EVENT_TOUCH_DOWN: + case EIS_EVENT_TOUCH_UP: + case EIS_EVENT_TOUCH_MOTION: + device->queue_frame_event = true; + break; + case EIS_EVENT_FRAME: + /* silently discard empty frames */ + if (!device->queue_frame_event) + return; + + device->queue_frame_event = false; + break; + default: + if (device) { + if (device->queue_frame_event) + eis_queue_frame_event(device); + device->queue_frame_event = false; + } + break; + } log_debug(eis, "queuing event type %s (%u)\n", eis_event_type_to_string(event->type), event->type);