Commit graph

286 commits

Author SHA1 Message Date
Peter Hutterer
51bec40aa5 tools/demo-server: split the keymap handling into two functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 11:36:44 +10:00
Peter Hutterer
08650b0268 tools/demo-server: set the server keymap in our local struct
Where the demo server is run with a --layout, set that in our local struct so
the printed messages use the correct keysyms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 11:36:37 +10:00
Peter Hutterer
787a664b5a libeis: don't treat it as bug when the client doesn't send a keymap
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 11:29:55 +10:00
Peter Hutterer
ab386f3cdb util: add an _unref_ cleanup + declaration function
To cut down on the boilerplate, an unref-able struct variable can now be
declared as
   _unref_(type) *name = NULL;
which is the equivalent of
   _cleanup_(type_unrefp) struct type *name = NULL;

Let's see how that style ends up reading.

This means we can get rid of the custom _cleanup_foo_ functions everywhere, no
need for all the extra #defines etc. A somewhat special case is systemd which
defines the various unrefp functions for us in the headers, so we can use them
directly.

OBJECT_IMPLEMENT_UNREF now also creates the unrefp function for this object -
this of course conflicts where DECLARE_UNREF_CLEANUP_FUNC is in scope. Not a
problem so far, let's see how we go.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 11:17:16 +10:00
Peter Hutterer
2076057ba2 util: add a macro to create unref cleanup functions
Slightly less boilerplate than before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:47:47 +10:00
Peter Hutterer
5e24b35ecb tools: use a cleanup func for the event in the demo client
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:47:47 +10:00
Peter Hutterer
ff6633db97 libei: Improve function namespacing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:47:47 +10:00
Peter Hutterer
93b96e42ad Add an EIS-controlled seat to the hierarchy
After CONNECT, the EIS implementation needs to add one or more seats. The
libei client can only create devices within those seats. This mirrors the
wayland hierarchy as well as the X.Org one.

The seat has a set of allowed capabilities, so the client knows ahead of time
when it may not be possible to create a specific device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:47:47 +10:00
Peter Hutterer
207cd5fd24 libei: rename added to device_added
Make space for a future seat_added/removed

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:10:16 +10:00
Peter Hutterer
faff1ed597 tools/demo-server: add --force to remove a leftover socket path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 10:10:16 +10:00
Peter Hutterer
9b6257bb9d libei: some more documentation and reshuffling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-20 16:11:10 +10:00
Peter Hutterer
799d64d284 doc: fix typos
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-20 15:49:40 +10:00
Peter Hutterer
d99d1e8707 libeis: better logging of client bugs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
7318512a89 libeis: switch the keymap to be a separate object
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
937f9fd8c5 libei: add a bunch of log messages for client bugs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
76d59c11c9 libei: switch the keymap to be a separate object
This fits better with the rest of the API and also fits much nicer into the
most common use-case of "device doesn't have a keymap".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
02efb19e2b libei: better logging of capabilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
3fc94f03b5 libeis: warn if connecting a device without capabilities
This is always a bug - where the device doesn't have recognized capabilities,
it should be rejected. libeis does the right thing and converts the
eis_device_connect() to a _disconnect() call but it's still useful to warn the
caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-01 15:28:46 +10:00
Peter Hutterer
070bdd9668 doc: fix a missing word
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-30 13:09:59 +10:00
Peter Hutterer
472f2ee84d util: disable coredumps for the munit helper
Really no need for those in a test suite

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-30 13:09:57 +10:00
Peter Hutterer
631fb3c0af Add C++ header guards
And a basic build test for C++ to make sure including the headers doesn't
completely fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:30:49 +10:00
Peter Hutterer
27cab50172 Mark the log functions as printf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:30:49 +10:00
Peter Hutterer
0ba6cc2740 Add a crawly to the bug message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:30:49 +10:00
Peter Hutterer
159d553ea3 test: switch the libei unit tests to the munit helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:30:49 +10:00
Peter Hutterer
261f34eda8 meson.build: fix the doxygen generation
Having an output of '.' means the $builddir/doc directory was removed on ninja
clean, only for ninja to then fail because doc/libei.h wasn't there. Let's use
the reference from meson test cases itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:29:40 +10:00
Peter Hutterer
7158cfc242 meson.build: drop unused install command
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:21:38 +10:00
Peter Hutterer
50617775bc libei: drop a no longer useful declaration
Obsolete with the object-based touch support

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-28 12:00:08 +10:00
Peter Hutterer
96ba358984 doc: hook up doxygen
Build the doxygen API documentation. This is copied from libinput so it takes
over that style (which is more readable than the default doxygen style).
Some extra documentation is added too and all the immediate errors are fixed
in this commit but doxygen still warns about undocumented parameters.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-28 12:00:08 +10:00
Peter Hutterer
9db3e80cf4 README: fix an outdated repo link
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-28 11:08:14 +10:00
Peter Hutterer
40d7b3cade Add support for touch events
Client-side the approach is a managed touch object rather than passing the
touchid around. This is intentional, it allows for a stackable API in the
future if we need to add things like pressure or major/minor to it.

On the server side the touches are managed through the event object anyway, so
we don't need the same abstraction there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-27 23:48:51 +00:00
Peter Hutterer
a27276b4c5 Drop mentions of capability monitoring
The original idea here was that a libei client could request the Pointer
capability to be notified of any pointer movements, thus providing a simple
way to capture input for the synergy use-case.

This is a can of worms better left untouched. How input events are captured
and what information is available is quite specific to the display server, let
alone the triggers for when it needs to start and stop. To have that in libei
requires something like triggers ("start when pointer hits the edge") which
again opens a new can of worms. Which seat are we referring to? What is a
screen edge? How about shortcuts?

Receiving input events can be handled by libeis anyway: any EIS server is
capable of receiving input events by definition so the capability monitoring
could be solved by making the capturing compositor a libei client and the
other process an EIS server. i.e. the circle is closed with:

[compositor|libei] -> [EIS|synergy-client]
                               ||
	                  [synergy-server|libei] -> [EIS|compositor]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 05:22:26 +00:00
Peter Hutterer
90d2b1b980 Add support for absolute pointer motion events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 11:24:58 +10:00
Peter Hutterer
09ad65d5c6 Implement eis_device_set_name and get_name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 11:21:46 +10:00
Peter Hutterer
eb40872770 Fix client-side removal of devices
Because events may be in-transit when a client removes the device, we need to
make this a full roundtrip to the server. Otherwise the client may assume a
device is removed, releases all references and then gets the original device
added event for that device. Better to have this as a round-trip instead.

This requires the server to call eis_device_disconnect() on the removed
notifications but we do so during eis_event_unref() anyway in case the server
forgets.

And it changes some of the API behaviors, so adjust the tests for that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:41:55 +10:00
Peter Hutterer
08da49debf libei: log the error when writing a message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:33:35 +10:00
Peter Hutterer
8eb7dde2cf libei: better device state debugging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:33:33 +10:00
Peter Hutterer
f27414d778 libei: move the event to string conversion to the top
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:26 +10:00
Peter Hutterer
423427c6da libei: better debugging of message types
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:03 +10:00
Peter Hutterer
297fb502f9 libei: remove ei_ prefix from the internal queue functions
An attempt to make things less confusing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:03 +10:00
Peter Hutterer
fa179e8778 libei: rename a set of functions for clarity
It's getting too confusing without prefixing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:02 +10:00
Peter Hutterer
374f08b4f0 libei: drop two obsolete declarations
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:01 +10:00
Peter Hutterer
ad87b67906 Move the CASE_RETURN_STRING macro to util-macros.h
No point redefining this everywhere

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-24 10:32:00 +10:00
Peter Hutterer
a89309558a eis: pointer motion is in doubles, not ints
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:44 +10:00
Peter Hutterer
c0aad25ae9 test: add a new peck EI behavior flag
The simple case - auto-handle anything until the first non-administrative
device event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:44 +10:00
Peter Hutterer
f6f8aa1fd1 test: improve debug logging for the integration tests
Visually easier to get a grasp on what's happening now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:44 +10:00
Peter Hutterer
003075c013 test: better debugging for missing events
Log the event type that is expected

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:44 +10:00
Peter Hutterer
b21bb04c4c test: use the event fetching helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:44 +10:00
Peter Hutterer
4c80b3df03 libei: export the eis_get_user_data() function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 15:49:28 +10:00
Peter Hutterer
9e60619439 libeis: better logging of new device capabilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 09:47:44 +10:00
Peter Hutterer
cc085b26f1 Print the event type name for debugging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 09:47:44 +10:00