libei/tools
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
..
ei-debug-events.c ei: add ei_ping() and the matching EI_EVENT_PONG 2024-12-18 04:30:01 +00:00
ei-demo-client.c Allow passing a fd to ei-demo-client 2024-08-08 09:55:43 +10:00
eis-demo-server-uinput.c eis: change the API to match the protocol interfaces closer 2023-05-05 14:04:17 +10:00
eis-demo-server.c eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks 2024-12-18 04:30:01 +00:00
eis-demo-server.h tools/demo-server: only print now if we actually have events 2023-05-08 13:47:06 +10:00
meson.build meson.build: allow disabling libei and libeis 2024-12-02 00:23:14 +00:00
oeffis-demo-tool.c tools: start ei-debug-events for the fd we get from the oeffis demo tool 2023-09-01 12:06:38 +10:00