libei/test
Peter Hutterer 73e0e8d339 eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks
This event is required to fix an issue with the current
ei_callback.done handling in libeis: previously we would imediately send
the ei_callback.done upon receiving ei_connection.sync from the client.
This results in incorrect behavior as we may have events in the queue
(and/or pending a frame) that the EIS implementation hasn't seen yet.
For example a client sending:
- ei_pointer.motion
- ei_connection.sync
- ei_device.frame
- ei_connection.sync

Will queue a motion + frame event on the EIS side during eis_dispatch()
but immediately receive done events for both sync requests.

This could be handled purely internally by keeping the sync event in the
queue but hidden to the caller - and automatically calling done when
it's that events turn, i.e. something like:

```
  struct eis_event *eis_get_event(struct eis) {
      struct eis_event *e = first_event(eis);
      if (e == EIS_EVENT_SYNC) {
           eis_callback_send_done(e);
           eis_event_unref(e);
           e = next_event(eis);
      }
      return e;
  }
```

but that opens us up to a set of potential bugs detailed in
https://gitlab.freedesktop.org/libinput/libei/-/issues/71#note_2694603

So let's go the easy route by having a new event type that does nothing
other than eis_event_unref() in the EIS implementation. This way we can
queue the event and have everything behave in-order and as expected.

Closes #71

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/316>
2024-12-18 04:30:01 +00:00
..
templates test: drop a bunch of unused imports 2023-02-15 08:20:01 +10:00
buildtest.c Purge libreis from the repo 2023-02-09 11:48:28 +10:00
buildtest.cc test: make the c++ build test mirror the c build test 2024-12-02 00:23:14 +00:00
conftest.py test: run pytest with xdist where available 2023-03-03 11:27:01 +10:00
eierpecken.c eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
eierpecken.h eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
eiproto.py.tmpl test: drop the use of attr 2024-12-10 05:06:49 +00:00
meson.build test: drop the use of attr 2024-12-10 05:06:49 +00:00
test-ei-device.c eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
test-ei-seat.c test: switch to use ei_seat_bind_capabilities() 2023-05-10 12:21:40 +10:00
test-ei.c eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
test-eis.c eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
test-main.c Remove empty trailing newlines from all files 2023-03-13 08:52:08 +10:00
test_oeffis.py test: rename a variable to shut up ruff with default args 2024-12-10 05:06:49 +00:00
test_protocol.py Add the ei_touchscreen.cancel event and ei_touch_cancel() 2024-12-17 15:12:56 +10:00
test_scanner.py ei-scanner: expose version_arg and version_arg_for 2023-05-26 16:56:13 +10:00
unit-tests.c Add SPDX identifiers to all source files 2022-03-03 00:27:36 +00:00