Commit graph

1052 commits

Author SHA1 Message Date
David Redondo
ebde54f3b3 ei-demo-client: Remove obsolote portal option 2024-08-08 09:54:13 +10:00
Peter Hutterer
9f82bbf344 test: add tests for multiple regions
Adds the test for
commit 0f81114544 ("Fix region check for devices with multiple regions")
2024-08-07 10:51:12 +10:00
Peter Hutterer
e411b85a33 Print the event type name for invalid events 2024-08-07 10:47:25 +10:00
Peter Hutterer
917b79f83e proto: clarify the ei_keyboard.modifier event a bit
This is an event in response to "something change the modifier state"
where "something" was not an ei_keyboard.key event on this interface.
Examples are NumLock on after resumed, a nonzero XKB group, etc.

Closes #57
2024-08-01 02:09:29 +00:00
Peter Hutterer
54dd4353df proto: remove ambiguous wording hunk from the interface_version event
This wording is confusing, see
https://gitlab.freedesktop.org/libinput/libei/-/issues/59#note_2501641

Remove the explicit mention of interfaces with client-side created
objects so we fall back to the default "client announces, server
confirms" which is all we need here anyway.
2024-08-01 02:09:29 +00:00
Peter Hutterer
2f8872676d proto: add an extra reference to the interface_version event
Just in case, so it's more obvious that those two negotiate each other.
2024-08-01 02:09:29 +00:00
Peter Hutterer
712e9513c6 protocol: correct false references to interface_version
This is the handshake_version request/event, not the
ei_connection.interface_version.
2024-08-01 02:09:29 +00:00
Peter Hutterer
798b0966de proto: clarify that the scale factor is a multiplication factor 2024-08-01 02:09:29 +00:00
Peter Hutterer
d6a8a5e94a proto: clarify that a client bug means ignored and/or disconnected 2024-08-01 02:09:29 +00:00
Peter Hutterer
362c4c392a proto: remove vestiges of ei_device.capability
This is now obsolete after [1]. The ei_device.interface event announces
which interfaces are available on the device so we don't need
documentation to say "it's a bug to send this request if the device
doesn't have the capability" since the client won't have the interface
to begin with.

Fixes: a902d5dbd8 ("protocol: replace the capabilities enum with an interface list")
2024-08-01 02:09:29 +00:00
Peter Hutterer
438140feb2 proto: correct the ei_device.interface documentation
Remove leftovers from when this was an ei_device.capability event
but since removed, see [1]. Instead make clear that this needs to be
one of the bound interfaces.

[1] a902d5dbd8 ("protocol: replace the capabilities enum with an interface list")
2024-08-01 02:09:29 +00:00
Peter Hutterer
0b2f46e1a2 proto: note that a touch without a region is a EIS bug 2024-08-01 02:09:29 +00:00
Peter Hutterer
a5dd5a5ee5 proto: fix a wrong interface reference: callback -> pingpong 2024-08-01 02:09:29 +00:00
Peter Hutterer
5331dc0bf2 proto: the keymap event is optional, clarify that
A device may not have a keymap in which case it just sends scancodes
hoping they'll be mapped to something sensible.
2024-08-01 02:09:29 +00:00
Peter Hutterer
b67cdba809 CI: avoid duplicate pipelines 2024-08-01 11:56:23 +10:00
David Redondo
e8a844355f oeffis: Make ConnectToEIS call async
A blocking call can be  problematic when done from inside Xwayland
to the compositor as the compositor could be doing a blocking X call
at the same time. In this instance we found it's likely to happen
because this call will happen shortly after the user accepted the
This is not a problem for the other calls because the portal API
is async for these via request response signalling.
2024-07-31 07:05:48 +00:00
Peter Hutterer
865d7152e0 util: replace a strncpy with a memcpy
We know exactly the lengths of everything involved here so let's use
memcpy. This way we don't need the stringop-truncation warning (a pragma
clang doesn't support anyway).
2024-07-29 05:15:53 +00:00
Peter Hutterer
3e2e43e352 ei-demo-client: use xkb_keymap_new_from_buffer()
This is the more correct approach since we get a sized buffer from the
server and people may use this as reference code in their implementation.
Technically we cannot expect a true zero-terminated string from EIS.

Unfortunately this means we need to work around
libxkbcommon#307 to strip trailing zeroes from the buffer if any exist.
2024-07-29 14:54:31 +10:00
Peter Hutterer
a924888f0f ei-demo-client: use mmap to read the keymap
Closes #55
2024-07-29 14:53:35 +10:00
Peter Hutterer
6ea468c823 util/memfile: use MAP_SHARED to create the map
Using MAP_PRIVATE means copy-on-write so our data written into the map
immediately disappears again. This leads to a empty string when sending
a keymap to a client.
2024-07-29 14:48:34 +10:00
Peter Hutterer
dc153c50ed util/memfile: include stddef for size_t 2024-07-29 14:48:34 +10:00
Peter Hutterer
c4ac084159 util/memmap: add a helper wrapper around mmap
Makes this easier to use with our unref functions.
2024-07-29 14:48:34 +10:00
Peter Hutterer
eb1d5a7e1a test: drop a custom cleanup func in favor of _unref_ 2024-07-29 14:32:40 +10:00
Peter Hutterer
a424458f03 Devices without regions pass coordinates as-is
If a device doesn't have a region (e.g. physical device) the answer to
"is this in the region" is always yes.

Closes #56
2024-07-25 01:17:39 +00:00
Peter Hutterer
0f81114544 Fix region check for devices with multiple regions
Use the ei(s)_device_in_region() to check for any region.

Closes #56
2024-07-25 01:17:39 +00:00
Peter Hutterer
87705ef97c scanner: handle the allow-null attribute for arguments
Currently unused but it's exposed, so yay...
2024-07-25 11:11:07 +10:00
Peter Hutterer
267716a760 proto: mark the explanation in disconnect as nullable
This is the only string in the current protocol that is nullable and our
DTD allows for that so it's not even an API break. Yay.

Closes #54
2024-07-25 11:11:02 +10:00
Peter Hutterer
4059820391 CI: bump to Fedora 40 2024-07-24 20:19:44 +10:00
Peter Hutterer
9ee399c8be CI: Lock hugo to v0.111 to allow for distro updates
F40 now ships v0.121 which again breaks something in the relearn theme
so let's lock our version here to one we know works and move on with
life. I can't be bothered to relearn hugo and themes every few months
just for a single static website.
2024-07-24 17:39:04 +10:00
Peter Hutterer
da1fa204d5 meson.build: bump the meson version by one
This allows us to drop one version check
2024-07-24 12:29:48 +10:00
David Redondo
23f056433d Fix API docs for EIS_EVENT_CLIENT_CONNECT
The functions with event in their name don't exist.
2024-04-09 06:39:13 +00:00
Matt Turner
33b4a61995 test: Raise SIGALRM interval to 50µs
On some platforms, an interval of 5µs is short enough that the test
spends its time almost exclusively processing SIGALRMs and never
progresses otherwise. Raising the interval to 50µs allows the test to
pass in a fraction of a second.

Bug: https://bugs.gentoo.org/916777
Closes: https://gitlab.freedesktop.org/libinput/libei/-/issues/50
2024-04-08 12:21:09 -04:00
Peter Hutterer
54ca521d0a proto: highlight the region 'hight' typo in the documentation
Changing this would be an API-breaking change (depending on how
bindings are generated) so we'll have to live with this typo for the
foreseeable future.

Closes #53
2024-03-12 04:25:33 +00:00
David Redondo
93efd3d14e eis-demo-server: Send a sensible discrete scroll value
So it can be a good example for people and doesn't log about
server bugs.
2024-03-05 22:47:05 +00:00
Peter Hutterer
08f1d41085 libei 1.2.1 2024-02-05 13:33:04 +10:00
Peter Hutterer
d29778658a oeffis: OEFFIS_DEVICE_ALL_DEVICES should translate to "all"
As the portal documentation [1] says:
  Bitmask of what device types to request remote controlling of. Default is all.

The default is only triggered if we do not submit the types at all, the
current behavior of sending a value of 0 means "none". Fix this by
skipping the "types" key if we try to select for all devices.

[1] https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.impl.portal.RemoteDesktop.html
2023-12-14 00:58:18 +00:00
Peter Hutterer
6ce695db3b test: yield the proxy, not the subprocess for the liboeffis fixtures
There's virtually no use for the process, so let's yield the proxy
object instead because we can make use of that.
2023-12-14 00:58:18 +00:00
Peter Hutterer
870123f54b CI: move the minium meson version job to debian
See 55e5deedd8 where this job was removed.
2023-12-14 10:44:54 +10:00
Peter Hutterer
eaed3883d8 CI: fix a hardcoded fedora and replace it with the jinja var 2023-12-14 10:44:54 +10:00
Peter Hutterer
97d66604fb CI: drop the git depth for the ABI check job
We need to make sure that we can checkout whichever sha was the last ABI
break.
2023-12-14 10:41:19 +10:00
Peter Hutterer
55e5deedd8 ci: bump to use F39
And drop the job to test the minimum meson version in the process. F39
ships with python 3.12 which causes this error with meson 0.56.0

proto/meson.build:17:0: ERROR: <ExternalProgram 'python3' -> ['/usr/bin/python3']> is not a valid python or it is missing setuptools

We could put the effort into setting up the CI to fix this, but we
won't.
2023-12-13 17:55:16 +10:00
Peter Hutterer
4936316884 libei 1.2.0 2023-12-06 08:19:00 +10:00
Peter Hutterer
9697aa9c74 pre-commit: autoupdate and add two more useful checkers
We don't have symlinks but let's check for them anyway. And check for
merge conflict leftoers too.
2023-12-05 14:25:10 +10:00
Peter Hutterer
38132d6fc5 ei: improve debug messages for keymap failures
Let's be more informative about what failed.

Fixes #48
2023-11-09 12:55:56 +10:00
Peter Hutterer
924341e174 ei: keep a cache of defunct objects to avoid spamming the log
Because of the asynchronous protocol, we may get this interaction

   server sends A->destroyed()
       client sends A->foo()
       client receives A->destroyed()
   server receives A->foo()
   server sends invalid_object_id(A)
       client receives invalid_object_id(A)

Previously we dropped the object after destroyed() and were thus
guaranteed to warn about the invalid object id for that same object
later.

Fix this by keeping a cache of defunct object IDs that we know about and
ignoring errors for recently dropped objects.

Every 20 ei_dispatch() calls we drop any defunct objects that were
unregistered more than 5 seconds ago.

Fixes #49
2023-11-09 12:47:06 +10:00
Peter Hutterer
4e634aa76c test: add the ability to add offsets to ei_now()
Build a separate libei-eierpecken.so that is identical to libei.so but
allows adding an offset to ei_now() for the eierpecken tests. That
offset is added to the return value of ei_now(), removing the real-time
dependency of the tests.

In other words, we can call peck_ei_add_time_offset(peck, s2us(5)) to
add 5 seconds to the time and continue the test as if that time has
elapsed.
2023-11-09 12:47:06 +10:00
Peter Hutterer
7999483a34 test: make bug logs fatal by default
We don't want to paper over bugs in the implementation, so let's make
any ei/eis error message with a bug in it fatal by default.

This needs to be disabled where we test for known-buggy client/EIS
behavior.
2023-11-09 10:15:38 +10:00
Peter Hutterer
fae41aac08 test: hack a peck_debug() function
To make it easier to print something debuggy from a test.

This is the MVP, it always requires an argument after the format string
but it'll do for now.
2023-11-08 23:24:45 +00:00
Peter Hutterer
34c83370be eis: fix a typo 2023-11-08 23:24:45 +00:00
Peter Hutterer
d31b5a1ccf eis: only queue a seat bind event if the caps change
This triggered an internal bug message in test_ei_seat_bind_unbind_immediately.

If a client unbinds all capabilities this triggers an EIS_SEAT_BIND with
zero caps. peck would call eis_seat_remove() which calls eis_seat_drop().
That queued another EIS_EVENT_SEAT_BIND with zero capabilities, leading
peck to call eis_seat_remove() again on an already removed seat.
2023-11-08 23:24:45 +00:00