Commit graph

13 commits

Author SHA1 Message Date
Peter Hutterer
564f14a739 ei: add EI_EVENT_SYNC as opaque event to correctly schedule callbacks
See the corresponding eis commit for details.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/316>
2024-12-18 04:30:01 +00:00
Peter Hutterer
a278c7b371 ei: add ei_ping() and the matching EI_EVENT_PONG
This wraps around ei_connection.sync to allow a C API user to add
synchronization points.

Closes #69

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/316>
2024-12-18 04:30:01 +00:00
Peter Hutterer
2acf42db9c tools/debug-events: add missing linebreaks to the modifier event
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/320>
2024-12-09 12:41:24 +10:00
Peter Hutterer
d9d4630567 tools/debug-events: print the region mapping id
This changes the region print format from a string to a dict
2023-09-01 12:18:20 +10:00
Peter Hutterer
c179b3dac1 tools: fix an indentation issue 2023-09-01 12:18:20 +10:00
Peter Hutterer
708aed6402 Export the event names through helper functions
Approximately every user of libei(s) will want something like this for
easier debugging, converting the numeric event type into something that
can be printed into the debug logs.

Let's provide this here so this doesn't need to be duplicated.
2023-05-22 02:39:08 +00:00
Ian Douglas Scott
cf932d1efb tools: Consistently refer to $XDG_RUNTIME_DIR
In one place, `$XDG_RUNTIME` was referenced. Which is wrong since the
variable is called `$XDG_RUNTIME_DIR`. The other uses referred to
`XDG_RUNTIME`, which could be taken as a shorthand, but it's clearer to
just use the name of the variable.
2023-05-20 02:28:48 +00:00
Peter Hutterer
3b8ce3dca1 Drop a few unused unref functions
Fixes 'warning: unused function 'ei_device_unrefp' [-Wunused-function]'
and friends.
2023-05-18 14:03:26 +10:00
Peter Hutterer
a890ce96bb tools: bind to the new capabilities in ei-debug-events 2023-05-10 12:21:04 +10:00
Peter Hutterer
da37da1308 ei: change the API to match the protocol interfaces closer
Now that the protocol interfaces are more fine-grained, let's match this
with the C API too.

This is just a rename of things so that in general
ei_pointer_*foo now becomes ei_foo*.

A few notable renames for better readability here:
- ei_device_scroll_delta (because scroll_scroll is awkward)
- ei_event_scroll_get_dx/dy and
  ei_event_scroll_get_discrete_dx/dy to indicate the delta-ness

Beyond that, clients must ensure to check/bind to the new
EI_DEVICE_CAP_BUTTON and EI_DEVICE_CAP_SCROLL capabilities to be able
to send button or scroll events.

Note that this API now allows for an EIS implementation to send a device
that only has a button or a scroll cap. Or a pointer cap without
buttons, etc. It's up to the clients how to handle such devices
(probably: ignore them).
2023-05-05 14:02:33 +10:00
Peter Hutterer
a5cc87c837 Purge the properties from the protocol
The primary use-case for these properties in libei itself was to send
some fixed information (pid, cmdline and conection type). In the portal
case, these can be obtained out-of-band via the portal. In the
non-portal case these can be obtained from the socket itself (fetch pid,
look up /proc/pid/cmdline) which is just as reliable as trusting
whatever libei sends.

The only other use-case for the properties was the activation id in the
InputCapture::Activated portal signal. This can be achieved with a
serial in the START_EMULATING event.
2023-02-09 11:48:29 +10:00
Peter Hutterer
8fc654bfb0 Purge the portal code
The original idea here was that we would have an EmulatedInput portal
that allows the application to connect directly to the EIS
implementation to exchange input events - instead of ping-ponging DBus
events through the xdg-desktop-portal as the RemoteDesktop portal
requires.

This is no longer accurate, there are suggested PRs open to add
RemoteDesktop.ConnectToEIS to achieve the same through the existing
RemoteDesktop interface [1] and to add a new InputCapture portal
to allow for events to be sent to a libei receiver context [2].

The example EmulatedInput portal is thus superfluous and can be removed
from here.

We could switch the ei_setup_backend_portal() code to use RemoteDesktop
or InputCapture, depending on the context type, the utility of this is
questionable. Interaction with portals is complex, one needs to
implement the Session/Request interfaces correctly and in the case of
InputCapture also handle the complex zones/pointer barrier setup.
libportal does some of this (or it will, anyway) so it's more useful for
an application to use libportal and then just pass the received fd to
libei.

If there is a future need for this to be handled as part of libei, we
can (re)implement this, but for now it's best to just purge all of this.

[1] https://github.com/flatpak/xdg-desktop-portal/pull/762
[2] https://github.com/flatpak/xdg-desktop-portal/pull/714
2022-12-08 10:45:47 +10:00
Peter Hutterer
a330b31713 tools: add ei-debug-events
Prints out a YAML-compatible list of events for debugging.

This tool also takes a --socketfd argument which names the fd number
that the EIS connection is on. This allows the tool to be started from
some other process that does the EIS connection, e.g. a portal
implementation.
2022-04-22 09:47:04 +10:00