Commit graph

419 commits

Author SHA1 Message Date
Peter Hutterer
bbbf2ff0f2 ei: add a helper function to create an event from a device
Just cuts down on duplication/room for error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-28 02:23:40 +00:00
Peter Hutterer
e3ed2c4ee6 proto: group the client messages vs events
This is just for easier readability and extensibility.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-28 02:23:40 +00:00
Peter Hutterer
56187e1543 eis-demo-server: add ei client tracking
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-28 02:23:40 +00:00
Peter Hutterer
7a91f27d42 eis: fix an error when the seat is removed twice
Previous sequence reproducible with the eis-demo-server and
ei-demo-client:
- ctrl+c the client
- eis client dispatch fails with an rc < 0 due to the socket being closed
- eis calls eis_client_disconnect() which calls eis_seat_removed()
  - that triggers an event for `SEAT_UNBIND`
  - seat is set to REMOVE
- eis-demo-server gets the `SEAT_UNBIND` event and (correctly) calls
  eis_seat_remove() since it doesn't know the client is disconnected
  yet. That is due to the library unwinding the state transparently.

Fix this by splitting out the calls: eis_drop_seat() is the internally
used one that sets it to a new state of REMOVED_INTERNALLY, and then
eis_seat_remove merely updates the state.

Fixes #10

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-25 15:48:22 +10:00
Peter Hutterer
6f3a62f5d2 Remove some if 0 code
If 0-ed out in the switch to server-side devices, this can go now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-22 00:57:36 +00:00
Peter Hutterer
95cca59647 test: remove a set of unused variables
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-22 00:57:36 +00:00
Peter Hutterer
1bcf6c2a61 eis: remove a default statement for better compiler warnings
Requires the same handling as 30d154b0d8
now

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-22 00:57:36 +00:00
Peter Hutterer
e885e5e3da proto: remove two superfluous semicolons
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-22 00:57:36 +00:00
Peter Hutterer
44b986daec proto: correct a few comments dating to an earlier version of this
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-22 00:57:36 +00:00
Peter Hutterer
3f97bacd21 meson.build: use gnu_symbol_visibility option
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-21 14:22:00 +10:00
Peter Hutterer
6801ab188b README: some updates for the current implementation state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-17 13:40:31 +10:00
Peter Hutterer
191913a9e3 gitlab CI: update the pages job to F35 too
Almost like there was a comment there telling me to do exactly that and
I didn't notice...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-16 14:48:41 +10:00
Peter Hutterer
d3149b75c2 gitlab CI: update to build on F35 and latest ci-templates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-16 13:36:59 +10:00
Peter Hutterer
47d8b2e0b5 Add static asserts to ensure our enums are sizeof(int)
Prevents any ABI suprprises by the enums being expanded to long or
shortened to char on special targets.

Fixes #11

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-16 03:25:42 +00:00
David Redondo
befbf2005c Free lockfile path
Signed-off-by: David Redondo <kde@david-redondo.de>
2021-12-05 23:14:54 +00:00
David Redondo
30d154b0d8 Allow compiling against newer protobuf-c
The internal enumerator name changed.

Signed-off-by: David Redondo <kde@david-redondo.de>
2021-12-01 17:04:39 +01:00
Peter Hutterer
b94a80d43a Add the two XML files for the current portal implementation
These aren't actually used here but it provides an easier-to-understand
example for what the current portal interface is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:29:44 +10:00
Peter Hutterer
802e5965cc tools: add a blurb to each tool to list what it is for
Let's not force users/developers to dig through the commit log to figure
out what each tool does.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:29:44 +10:00
Peter Hutterer
28532aa9c6 tools: no need to abort on errors in the fake portal
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:29:44 +10:00
Peter Hutterer
b863445c28 tools: default to LIBEI_SOCKET in the fake portal too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:29:44 +10:00
Peter Hutterer
df5237a7ea tools: update the portal for the latest version
The latest version of the portal communication adds session capabilities
and wraps the calls a bit differently.

This now  also includes a helper tool for the impl.portal part so we can
run xdg-desktop-portal against that without the need for a mutter
implementation.
Use:
- run the eis-demo-server
- run the eis-fake-impl-portal
- run the xdg-desktop-portal (it'll use the fake impl portal)
- run an ei client with the portal enabled

Note that the ei-fake-portal is a shortcut, it will open eis directly
without going through the impl.portal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:29:44 +10:00
Peter Hutterer
43be3ddc89 util: add a strreplace function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 12:26:05 +10:00
Peter Hutterer
4b3b48291b tools: whitespace fixes in the demo client
And fix a missing field initializer warning while we're here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-27 09:14:00 +10:00
Peter Hutterer
5c017654e8 ei: always queue a disconnect event locally
In the case of a refused portal connection we get disconnected before we
had a chance to send the CONNECT message. This still needs to queue a
disconnect event and thus bubble back up to the caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 16:43:06 +10:00
Peter Hutterer
1e8c184d8e tools: set the default properties in the fake portal
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 12:47:07 +10:00
Peter Hutterer
6197e5a34e tools: print the default properties from the demo server
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 12:47:07 +10:00
Peter Hutterer
ed208f8374 ei: add an ei.connection.type property to be filled in automatically
Planned values: 'socket' and 'portal', the latter to be set by the
portal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 12:47:07 +10:00
Peter Hutterer
1ae193160e eis: differ between eis vs ei property updates
If we have libreis setting properties on the connection, this looks to
the server like they're coming from the ei connection. But libreis is a
different context than the libei context later, so when libei
initializes, it may set the same properties again. Since the libei
context doesn't know about the properties, it can't filter internally
and will send the properties to the server.

So we need to do all the permissions checks in the server to make sure
we don't overwrite values that we're not allowed to overwrite.

There are no real restrictions on changing properties from within the
eis implementation (other than not being able to set the reserved
namespaces).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 12:44:53 +10:00
Peter Hutterer
b77b9dc059 reis: add property support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 12:29:19 +10:00
Peter Hutterer
7fc9498f1d reis: simplify the library a bit
Pass the fd into the original context creation, then write any changes
to the wire immediately. For the capabilities that means we can't build
them up as before anymore, so change the API to have a vararg function
and require the allowed capabilities to be passed in.

There's likely little use for the previous allow-vs-deny policy etc, so
let's not make things more complicated an they have to be.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 10:14:03 +10:00
Peter Hutterer
4376e8da88 reis: duplicate the device capabilities
Let's keep the three libraries properly separated.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 09:53:36 +10:00
Peter Hutterer
6768b8170b reis: use the same message helper macro we already use for eis/ei
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 09:39:59 +10:00
Peter Hutterer
95f00361b3 tools: fix a whitespace issue/compiler warning in the fake portal
Whitespace issue originally, but let's fix it so that clang no longer
complains about missing initializers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 08:47:53 +10:00
Peter Hutterer
128e8f1bab tools: fix the wrong default busname documentation for the fake portal
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-26 08:46:41 +10:00
Peter Hutterer
1225bcb0e1 Add a property API for generic key/value exchanges
There is data that libei and the EIS implementation will want to
exchange that is not covered by the immediate API.

To avoid having to add APIs for all of these, let's provide a generic
property API that both server and client can use to exchange this info.

The property API provides read/write/delete permissions but those only
apply to the client, not the server. The idea is that a server can
create (or restrict) properties that the client can read but not modify
and/or delete. A special-case are properties filled in automatically by
libei: ei.application.pid and ei.application.cmdline. These could be
used by e.g. the portal implementation to match permissions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-25 13:35:36 +10:00
Peter Hutterer
77c898c3b8 eis: fix some documentation copy/paste-o's
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-25 11:25:32 +10:00
Peter Hutterer
1bb5e103ab Split connect into an additional connect_done
This allows us to transmit extra information about the client before the
server has to decide on whether it wants to connect us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-25 11:25:32 +10:00
Peter Hutterer
a03f547989 proto: add a start/stop emulating message pair
This effectively provides the EIS implementation with a notification
that the client will actually send events in the near future. To be used
by e.g. synergy-like clients when the pointer enters the logical screen
so that the EIS implementation can flash a warning or something.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 13:14:20 +10:00
Peter Hutterer
9e83e2fb3e test: add color printing to the test log output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 13:14:20 +10:00
Peter Hutterer
9013702534 tools: fix the demo clients' frame events for kbd/abs
Unsurprisingly segfaults on EIS implementations that don't provide a
pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 13:14:20 +10:00
Peter Hutterer
1cfa62859f test: fix segfault if we're expecting an event on an empty queue
Checking the event type on a NULL event doesn't work too well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 10:31:12 +10:00
Peter Hutterer
1884785a8a Add a scroll stop/cancel event
This allows a client to trigger kinetic scrolling (or prevent it).
For compositors implementing EIS, the only realistic scroll source is
continuous which allows for scroll stop events. So let's give the client
the opportunity to trigger those on demand.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 09:21:05 +10:00
Peter Hutterer
781f4dc1f8 test: add a scroll test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 09:21:05 +10:00
Peter Hutterer
55594cd09c Add a frame event to logically group events together
Already present in e.g. libinput and wayland, this event allows us to
group several events together to denote them as a logical group.
Required for multi-touch but as we've learned with Wayland it's also
required to group other events (scroll events in the case of Wayland).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-24 09:21:05 +10:00
Peter Hutterer
6f70e97cce Implement key modifier mask events similar to Wayland
Since the server controls the keymap, and that keymap is likely merged
with some other device let's add the events so we notify the client of
things like numlock-is-down etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 15:03:15 +10:00
Peter Hutterer
730a82d28d proto: rename the Frame message to Packet
We're about to use Frame in the protocol itself, so let's not make those
confusing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 15:03:15 +10:00
Peter Hutterer
8a355bbc2a Add missing scroll/scroll discrete to the test debugging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 15:02:26 +10:00
Peter Hutterer
ae6dbbe61c test: move the unhandled event type assertion out of the switch
All the switch cases return early, moving it here means we can drop the
default case and have the compiler warn us about missing cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 15:02:19 +10:00
Peter Hutterer
5ae3b78689 test: drop an obsolete test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 13:02:26 +10:00
Peter Hutterer
b08ec3cea4 ei: split event handling into its own source file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-23 12:26:07 +10:00