Commit graph

251 commits

Author SHA1 Message Date
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
Peter Hutterer
4de3380a88 test: make the peck_dispatch_until_stable() a macro
This way we can insert the line number for easier debugging

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-23 09:41:23 +10:00
Peter Hutterer
c72f27b4c2 eis: switch to eis_device_allow_capability()
The previous approach would implicitly allow any capability not known to the
server. Switch instead to requiring an explicit 'ok' for any capability the
server wants to support.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-17 05:29:01 +00:00
Peter Hutterer
3c464186c6 util: allow source_remove(NULL)
Removing a non-existing source has the desired effect after all - the source
won't generate events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 14:07:23 +10:00
Peter Hutterer
e6acbdfa31 eis: include util-object for the socket backend
For correctness, it's pulled in by one of the other headers anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 14:07:12 +10:00
Peter Hutterer
d2fdb2ae0e Fix two minor typos
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 14:07:06 +10:00
Peter Hutterer
31800cf870 util: make the OBJECT_IMPLEMENT_CREATE no longer static by default
Better for consistency with the other functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-15 23:23:51 +00:00
Olivier Fourdan
325d7e6a43 libei: Do not abort if LIBEI_SOCKET is not set
When called with NULL as the path to the EI socket, the function
ei_setup_backend_socket() will fallback to the LIBEI_SOCKET environment
variable to determine the path to the socket.

If that environment variable is not set, ei_setup_backend_socket() will
abort.

That means that an innocent client running in an environment without EI
support will be killed. If that client happens to be Xwayland, that would
abort the Xserver and take all X11 clients with it, including the window
manager itself in the case of mutter.

Return -ENOENT instead so that clients have a chance to recover and
survive the lack of EI support.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-09-15 22:19:03 +00:00
Peter Hutterer
24a74f1b26 gitlab CI: change the repo location to the proper upstream one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 08:15:18 +10:00
Peter Hutterer
6ffdaab8f3 util: use xclose for the _cleanup_close_
Silences the valgrind warnings for fds that are initialized with -1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-14 19:41:14 +10:00
Peter Hutterer
7605c7afa2 Make sure the keymap_fd is always -1
Default value for this is 0 so if we forget to check the keymap type (which we
do) we may end up treating it as a valid fd, closing stdin and generally
causing mayhem.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-14 18:22:02 +10:00
Peter Hutterer
f202228e57 meson.build: rename the libei portal pkgconfig variable to just "portal"
This is the libei.pc pkgconfig file, we don't need to namespace for ei in
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-03 11:11:11 +10:00
Peter Hutterer
4a918d17d8 libeis: namespace the capability-specific getters and setters
Naming scheme is now: ei_device_<capability>_get/set_<what>. So far the
range is the only one where we had to deal with the same thing for two
different capabilities and it's unlikely we'll have to have different keymaps
for different capabilities. But still, let's do this now while it's still
easy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-28 14:13:56 +10:00
Peter Hutterer
e4840d4523 libei: namespace the capability-specific configure calls
Naming scheme is now: ei_device_<capability>_configure_<what>. So far the
range is the only one where we had to deal with the same thing for two
different capabilities and it's unlikely we'll have to have different keymaps
for different capabilities. But still, let's do this now while it's still
easy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-28 14:13:53 +10:00
Peter Hutterer
da1b31fa59 README: jot down some notes regarding XTest vs libei
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-28 13:11:39 +10:00
Peter Hutterer
3b90296237 tools/demo-server: add a uinput example handler
This is a basic example on how an EIS server can map to uinput, just to
illustrate that there's nothing in libeis that requires a display server
protocol (X or Wayland). All that's done here is we set up a keyboard and
pointer device and route the input events through that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 12:52:50 +10:00
Peter Hutterer
f45a23e466 tools/demo-server: abstract the event handler
Move this to handle_event function so we can swap out what actually deals with
the events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
5d85ea4c8f tools/demo-server: use _cleanup_foo_ functions for eis and eis_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
22930d0d2b tools/demo-client, demo-server: use the new color print functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
c169e10af7 util: move the colorprint to util-color
And extend it a bit to be more flexible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
4ae108fbff libeis: implement eis_device user_data getters/setters
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
ac42578811 replace the fallthrough comments with __attribute__((fallthrough))
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-26 11:00:50 +10:00
Peter Hutterer
f8a2729d7f README: add a graphic to illustrate how XWayland looks like
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 14:30:17 +10:00
Peter Hutterer
6b3d9255cf libei: implement org.freedesktop.portal.EmulatedInput support
The current implementation of that portal has two methods: EmulateInput to
authenticate and Connect to get the fd to the EIS implementation. The portal
implementation is in charge of finding EIS and restricting it if need be.

This uses libsystemd because we can integrate that with epoll and our
libei_dispatch() method. GDBus requires a glib mainloop, so it's not really
suitable here. Given how simple this is anyway, it's easy to just do the DBus
bits in the caller and then hand the fd to ei_setup_backend_fd().

A eis-fake-portal is provided for testing, this "portal" can use the custom
portal bus name and connect the eis-demo-client to the eis-demo-server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 13:35:18 +10:00
Peter Hutterer
f6c2f24a22 util: add xconnect to connect to a socket
Makes this re-usable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:47:07 +10:00
Peter Hutterer
b49e4a48c9 test: move the sources and io tests to the util unit tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
b064d435ec test: make a separate binary for the utils tests
And add the tests for the list and string helpers as a first use-case, copied
from the libinput tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
f06095e0c8 libeis: fix the client-side keymap assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
31988e056d tools/demo-client: print a server-side keymap if there was one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
ee1935b8c5 tools/demo-server: add support for keymap overrides
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
bc2bd3c09a libeis: correct the name of the set_keymap function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
04dab83115 tools/demo-client: make the XKB layout a commandline argument
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
901235af5c tools/demo-server: add option parsing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
55d92c8f61 tools/demo-client: hook up --verbose
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
c4f1a9107e tools: rename the socket server tool to eis-demo-server
Conveys more of it's meaning

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
c063ec023c tools/ei-demo: add hooks for choosing a backend
None exist other than the socket one but hey, the infrastructure is there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 20:45:37 +10:00