ei: add receiver handling for empty/flushing frame events

Where the sender sends empty frame events, or a device event without a
subsequent frame events ensure that event is filtered or emulated in our
event queue.

Note: because of our sender filters, we cannot actually test
this, at least not easily. Let's hope it works.
This commit is contained in:
Peter Hutterer 2022-05-05 13:46:26 +10:00
parent f0605b5e53
commit 5b286a4d3a
3 changed files with 32 additions and 3 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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);