Commit graph

1163 commits

Author SHA1 Message Date
Peter Hutterer
19b6453540 libei 1.5.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-08-26 11:25:18 +10:00
Peter Hutterer
cae398c132 test: add a test for delaying the ping/sync
For both the tests send two pings, with a keyboard event in between.
Where the ping is processed, fetch all the events first up front, and
process them one by one in the right order.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-25 13:36:18 +02:00
Peter Hutterer
6c50e2f8a0 test: add support for disabling behaviors on the ei/eis context
Historically the preference for testing was to enable a bunch of
specific behaviors and then leave that as-is for the test. This can be
painful for some events, in particular sync/ping that are used
internally by libei's implementation.

Testing those events requires us to match the implementation-defined
internal setup which is a pain. Much easier to add a function
to allow disabling a specific behavior at some point during the test

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-25 13:40:49 +10:00
Peter Hutterer
7667d1fcd8 test: make some behavior enabling more expressive
Remove the non-obvious +1/-1 and use the enum values instead. Then group
the two together better and remove an unnecessary separate handling of
the flag setting.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-25 12:45:11 +10:00
Jonas Ådahl
5e57b1ed5f ei: Expose ei_event_ref()
As with eis, expose ei_event_ref() as well, for consistency.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-21 17:08:53 +02:00
Jonas Ådahl
42b9a89371 eis: Expose eis_event_ref()
This makes handling prolonged synchronization sequences easier, as one
doesn't have to work around only being allowed to hold one reference.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-21 17:08:53 +02:00
Jonas Ådahl
8d86ada12d ei: Send sync done event on last event unref
This allows the application to hold the sync event for a while longer,
e.g. to ensure previous events from ei have passed through relevant
plumbing and reached their internally intended targets, which might
happen synchronously between each processed ei event.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-21 17:08:53 +02:00
Jonas Ådahl
1010cdff3c eis: Send sync done event on last event unref
This allows the application to hold the sync event for a while longer,
e.g. to ensure previous events from EIS have passed through relevant
plumbing and reached their internally intended targets, which might
happen synchronously between each processed EIS event.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
2025-08-21 17:03:27 +02:00
Axel Karjalainen
525d55a532 docs: Fix issues and make some language clearer
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/344>
2025-08-14 00:07:09 +00:00
Axel Karjalainen
70c3348dfe docs: Extend summaries
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/344>
2025-08-14 00:07:09 +00:00
Axel Karjalainen
4d999849ee docs: Make the description of context types more generic
The protocol should be separate from any specific implementation's own
terms.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/344>
2025-08-14 00:07:09 +00:00
Axel Karjalainen
f3f69e3a96 doc: Correct meaning of ei_connection.disconnected
Closes https://gitlab.freedesktop.org/libinput/libei/-/issues/85

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/344>
2025-08-14 00:07:08 +00:00
Peter Hutterer
3b98946b9a eis: only send scroll/button capabilities if the client supports them
Commit a902d5dbd8 ("protocol: replace the capabilities enum with an interface list")
added automatic handling for button/scroll interfaces on the protocol
because the libeis C API didn't have those as separate interfaces yet.
Any EIS implementation with POINTER/POINTER_ABSOLUTE would always
announce BUTTON/SCROLL capabilities.

Later in commit e6954b76d3 ("eis: change the API to match the protocol interfaces closer")
the required C APIs were added but this handling was never removed so an
EIS implementation always replied with button/scroll capabilities even
where not set. Fix this by removing this automatic announcement.

Fixes: e6954b76d3 ("eis: change the API to match the protocol interfaces closer")
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/353>
2025-08-05 07:02:57 +00:00
Peter Hutterer
7347aeacd2 eis: only send interface versions that the client announced
Do not reply with interfaces that the client never requested.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/353>
2025-08-05 07:02:57 +00:00
Peter Hutterer
1faaacda6e eis: send the interface version for the scroll interface
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/353>
2025-08-05 07:02:57 +00:00
Axel Karjalainen
e3e143ea42 test: fix false fail by actually looking for unbound capability mask
The previous implementation of
`test_seat_bind_invalid_caps_expect_disconnection`
didn't follow the protocol specification and assumed that `0x1` was
invalid.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/354>
2025-08-05 02:02:38 +03:00
Ian Douglas Scott
500ad0510f test: Advertise scroll/button interfaces in test_connect_receive_seat
This test was checking for the capabilities for `EI_SCROLL` and
`EI_BUTTON`, but not advertising those interfaces initially. Presumably
this was unintentional, given there's no comment that it's intentionally
advertising some protocols but not others.

Also, should the test have failed to find the capabilities when it
didn't advertise the protocol to to start with? This change just fixes
the test, anyway.

This was causing the test to fail for `reis` CI in a proposed change in
https://github.com/ids1024/reis/pull/11.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/352>
2025-07-31 19:33:26 -07:00
Peter Hutterer
45c526bcc9 ei: indentation fix
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/351>
2025-07-24 11:07:32 +10:00
Peter Hutterer
297f95efac utils: add the etrace macro
Same as the existing trace but prints to stderr. And #include stdio so
we can use this file as-is instead of needing extra includes.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/351>
2025-07-24 11:07:32 +10:00
Peter Hutterer
0831303a70 test: change peck_new_context to take varargs
This makes peck_new_context() take variable arguments in the style
key, v1, v2... where each value is defined by the free-form key.

What we need right now is the mode of the context, so let's add that.
In the future we will add more configurable bits here.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/351>
2025-07-24 11:07:32 +10:00
Peter Hutterer
0488b4b4d0 test: expand peck_new() to take varargs
This enables us to pass various configuration into the peck context
in the future without having to update every single test that doesn't
need that particular configuration.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/351>
2025-07-24 11:07:32 +10:00
Peter Hutterer
55335b9030 libei: fix the docs for the various _unref functions
Copy/paste from ei_unref but none of the others will disconnect the
context.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/349>
2025-07-24 00:54:06 +00:00
Peter Hutterer
12237f19ea ei: don't use the connection until we have one
If we're in EI_STATE_BACKEND ei->connection is NULL, causing a segfault
if in this state we unref our ei context.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/350>
2025-07-18 13:26:01 +10:00
Jonas Ådahl
6194880aa9 libeis: remove leftover debug log
Fixes: 73e0e8d339 ("eis: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks")
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/348>
2025-07-16 13:42:13 +10:00
Peter Hutterer
5567524ecc Swap accidental trailing comma for a semicolon
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/347>
2025-07-11 00:59:06 +00:00
Jason Gerecke
883a60d4e6 oeffis: Correct spelling errors in log messages
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/343>
2025-07-02 14:03:34 -07:00
Jason Gerecke
6aa4dc0c7e doc: Correct spelling errors in the code documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/343>
2025-07-02 14:03:34 -07:00
Jason Gerecke
ac9b92bbae proto: Correct spelling issues in the protocol documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/343>
2025-07-02 14:03:33 -07:00
David Redondo
70cfc6eed2 Make it possible to fetch the pid of a client in socket mode
This is useful to get some more info about clients that try to
connect.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/339>
2025-07-01 08:50:48 +02:00
Kacper Piwiński
54e71e6dd5 util: don't call function in macro argument
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/342>
2025-06-29 07:48:45 +00:00
Kacper Piwiński
1b11d10ff2 util: use already computed strlen
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/342>
2025-06-29 07:43:34 +00:00
Peter Hutterer
edc8ea045a eis: don't warn about EPIPE, just debug-log it
While it's not the friendliest way of a client to exit, we do need to
expect clients to disconnect any time and that shouldn't trigger
warnings, it's somewhat expected behavior.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/337>
2025-06-16 11:20:21 +10:00
Peter Hutterer
8cd2b01bfa test: expose the ei socket fd to tests
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/337>
2025-06-16 11:20:21 +10:00
Peter Hutterer
98e445ebdb test: add ability to capture logs
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/337>
2025-06-16 11:20:21 +10:00
Peter Hutterer
dbeff9a90d test: add a bunch of strv helpers
Taken from libinput

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/337>
2025-06-16 11:20:21 +10:00
Peter Hutterer
efdc58e094 test: remove an unused function
Obsolete since 479bda259a ("Purge libreis from the repo")

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/338>
2025-06-13 16:49:03 +10:00
Jason Gerecke
50ff529a76 Fix MIT license header text
Corrects an issue where a wild search-and-replace mangled the license
texts on protocol implementations.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/335>
2025-05-29 23:07:48 +00:00
Jason Gerecke
6c5b486306 scanner: Avoid trailing full stops in regex search for protocol names
Continue to find nested ei_foo.bar.baz but avoid including a trailing
full stop, if it exists.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/336>
2025-05-29 14:35:19 -07:00
Jonas Ådahl
ee27dd5c92 ei-device: Don't leak fd when receiving the keymap
The ei_keymap dups the file descriptor, so lets close the one we
received from the demarshaller.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/334>
2025-05-22 22:43:35 +02:00
Peter Hutterer
851f935fe1 tools: print missing event types in the demo client
Instead of aborting, print something useful

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/332>
2025-05-19 11:34:54 +00:00
Peter Hutterer
2556ad38c6 tools: handle EI_EVENT_SYNC in the demo client
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/332>
2025-05-19 11:34:54 +00:00
Peter Hutterer
b2484c00d0 CI: bump to Fedora 42 and latest ci-templates
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/333>
2025-05-19 16:11:49 +10:00
Peter Hutterer
daba46a2ae eis: if a client is slow, queue up messages for future delivery
If a receiver client stops calling ei_dispatch for a while eventually
we fill up the send buffer, causing messages to be quietly dropped.
When the client resumes the message stream resumes with whatever we send
next but that can leave the client in an inconsistent state.

deskflow hit this in the server-side where our event sequence of pointer
motion+frames eventually filled up the buffer, causing
eis_device_stop_emulating() to be silently dropped. On the next
InputCapture sequence eis_device_start_emulating() was sent to an
already emulating client (as seen by the client).

This patch adds a secondary queue, if we fail to send a message with
EAGAIN queue it up and flush that queue whenever the next message is
sent. Meanwhile any newly added messages go straight into that queue.

The caveat here: a nonresponding client will eventually trigger OOM,
there is no upper limit on the messages yet

This is the libeis version of
commit 69e973e6b3 ("ei: queue unsent messages for later delivery if our buffer is full")

Closes: #79
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/331>
2025-05-02 15:40:47 +10:00
Peter Hutterer
daf0b24665 test: add a test for multiple start/stop emulating events
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/331>
2025-05-02 15:40:47 +10:00
Peter Hutterer
247a3d49d7 ei: print the sequence number on error for a start_emulating event
This may help debugging which sequence triggered an error.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/330>
2025-05-02 05:39:52 +00:00
Eric Long
e147d4311f test: increase protocol-test-valgrind timeout
Currently libei's valgrind test setup has 100x timeout (3000s), but the
standalone protocol-test-valgrind still has 30s timeout, which is not enough
for RISC-V hardware. On Milk-V Pioneer (SG2042) it takes ~70s to complete. In
addition, `kill_gently` sends SIGKILL before the process terminates and fails
the test.

Bump protocol-test-valgrind timeout to 300s and increase timeout between kill
signals to 3s to solve the issue.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/329>
2025-04-11 15:32:20 +08:00
Peter Hutterer
9e0413cbc7 libei 1.4.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-04-01 13:52:48 +10:00
Peter Hutterer
962863cbc4 scanner: ensure 'since' doesn't exceed the interface version
See https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/327

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/328>
2025-03-31 10:00:19 +10:00
Peter Hutterer
b0deafc641 scanner: convert the 'version' and 'since' arguments to int
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/328>
2025-03-31 10:00:05 +10:00
Ian Douglas Scott
fa21d765a1 proto: Fix version for ei_touchscreen
Fixes: b1c1c5d579 ("Add the ei_touchscreen.cancel event and ei_touch_cancel()")
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/327>
2025-03-31 09:11:56 +10:00