Commit graph

361 commits

Author SHA1 Message Date
Peter Hutterer
eaefaecdd0 eis: fix the seat assignment
We're using the upper bits for seats, just adding 1 clashes with the
device ids.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-17 16:08:26 +10:00
Peter Hutterer
1134630655 ei: ignore button codes below BTN_MOUSE
Filters out the likely bug of a caller hoping that buttons 1/2/3 will
work (as opposed to BTN_LEFT, etc.)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-17 16:05:22 +10:00
Peter Hutterer
627db8d91e gitlab CI: bump the pages job to F34 too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-16 16:09:26 +10:00
Peter Hutterer
a240e181c0 gitlab CI: bump the Fedora version to 34
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-16 15:50:07 +10:00
Peter Hutterer
50387078d6 editorconfig: add yml files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-16 14:58:51 +10:00
Peter Hutterer
e06d9bd380 meson.build: disable documentation by default
This is in gitlab pages and designed to be an online documentation,
let's not require everyone to build it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-16 14:58:51 +10:00
Peter Hutterer
5adf87cdda tools: hook up absolute pointer motion in the demo client
Prints the regions and sets the pointer to somewhere around 150/150

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
0991660820 Add user data to keymaps
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
1f9539540e Use a helper macro for the protobuf message setup
All of this is always the same steps, let's use a macro so we can limit
our code to the bits we actually need to do.

This requires renaming some of the protocol itself to match up with the
expectations - not the worst thing since it makes the protocol more
consistent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
09929534bf proto: split the touch event into its three separate events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
6749bf3121 eis: split the internal touch API into three functions for down/up/motion
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
8022f17f4c eis: switch eis to use interface structs
Just like with the libei code, this removes a few layers of indirection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-12 15:39:26 +10:00
Peter Hutterer
5747cbf8b8 eis: fix the object creation API again
It's now consistently parent_new_child().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 16:34:10 +10:00
Peter Hutterer
86bac02026 ei: remove another layer of indirection before we hit the protocol
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 11:59:57 +10:00
Peter Hutterer
e3fd50bae7 ei: abstract the requests into an interface struct too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 11:06:07 +10:00
Peter Hutterer
1a38bad756 proto: swap the ei message parsing for an interface struct
This gets rid of one layer of indirection with the struct message in
between - we can now call from the proto parser into the handling code
directly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 10:49:36 +10:00
Peter Hutterer
c9b374c383 test: bring back the keymap tests
We can drop the test of the server overriding the client's keymap,
that's no longer a thing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:30:05 +10:00
Peter Hutterer
379f47b06b proto: split the keymap message out from the device added message
Same approach as used for the regions already, a separate (optional)
message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:29:58 +10:00
Peter Hutterer
2ec3328447 tools: use the linux event codes now that we're including the header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:29:56 +10:00
Peter Hutterer
3abf13742a Restructure keymap handling to server-side only
This keeps most of the current structure but gets rid of client-side
keymaps (which have been broken since the server-side devices anyway).
The new approach: clients get a keymap (or NULL) from the server, if
they don't like it they will have to do transformation on their side.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:29:55 +10:00
Peter Hutterer
55b79c44a5 test: check for 2 empty dispatch run before considering a stable state
With keymap messages, we may get and process data on the wire
but it doesn't necessarily result in a visible event. We need to enter
dispatch again to process the data in the next packet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:29:50 +10:00
Peter Hutterer
3aa75890e9 eis: change the regions API to use eis_region_add()
This is slightly inconsistent with the configure API but more consistent
with the device API (which also has a new() + add()). It reduces
potential bugs though because the region cannot be added to two devices
anymore, and this way we also get a context in the region from the start
(which means we can log).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
712e37eb3b tools: fix a typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
a522808253 tools: fix keyboard cap in the EIS demo server
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
0f9030c588 doc: fix the docs for the connect event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
4ef359dc9b Fix a debug message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
59c4aef9d7 ei: drop pointer/touch width and height
Obsolete now that we have regions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-11 09:09:08 +10:00
Peter Hutterer
cb4dcaa078 ei: two more bug log messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-09 18:48:11 +10:00
Peter Hutterer
ecd75fcf40 tools: add an abs device and regions to the demo server
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-09 15:45:06 +10:00
Peter Hutterer
15316dd2ab Add two convenience methods for region point conversion
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-26 15:45:08 +10:00
Peter Hutterer
6095a0d99f Add a physical scale factor for the regions
This isn't something that libei itself uses but clients like synergy
need to know about this to be able to map relative pointer motion from
one host into the right physical pixel on another host.

This is required for mutter in the x11-compat mode where a 4k screen is
logically twice the size of a 2k screen, despite having the same
physical size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-23 15:06:01 +10:00
Peter Hutterer
56b82c2b8f Add DeviceRegions to replace the pointer/touch ranges
This is required for supporting synergy/barrier and similar clients.
Replacing the touch and pointer range we now have server-defined
rectangular regions that specify the active zones for this device.

For example, a dual-monitor EIS server would create two touch devices
with one region each for the respective monitors - libei-generated
touches would thus fall on the right area of the monitor. Or just one
device with one region if the second screen should be inaccessible.

A relative device may have multiple regions since it can reach all
screens in the layout.

This leaks the screen layout to libei but that is necessary for the
functionality to work. A libei client may need to control devices
through absolute coordinates and it needs to know where screen
transitions from one to the next screen happen:

  +-----------++----------------+
  |           ||                |
  |          B||Q               |
  |           |+----------------+
  |           |
  |          A|P
  +-----------+

In the above example, position P is unreachable and a client that
controls input on both screens must know that it cannot transition from
A to P but it can transition from B to Q.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-23 15:06:01 +10:00
Peter Hutterer
12b04fdeb0 Add a DeviceAddedDone message to the protocol
Similar to wayland's done message, this signals the end of the device
configuration.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-23 14:26:38 +10:00
Peter Hutterer
0578a8cbb6 doc: fix some doxygen markup errors
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-23 14:25:56 +10:00
Peter Hutterer
088c328251 doc: change to doxygen-awesome
Much better looking than the previous style, even with no custom
configurations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 14:20:18 +10:00
Peter Hutterer
926644e669 util: remove the need for a tmp argument in list_for_each_safe
With a bit of trickery, we can declare the tmp variable inside the for
loop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:13:03 +10:00
Peter Hutterer
c0f9e40282 Pass the file/line/func information through to the ei/eis loggers
This is useful for debugging, let's pass it through and let the log
handler decide whether to use it or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:09:39 +10:00
Peter Hutterer
7f4c8b8247 util: pass the file/line/func information through to the logger
This is useful for debugging, let's pass it through and let the log
handler decide whether to use it or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:09:39 +10:00
Peter Hutterer
b527128c27 test: don't print the message type for debug
Make Warning, Info and Error stick out more this way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:09:39 +10:00
Peter Hutterer
a228dee0d2 eis: include util-macros in the private header for _printf_
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:09:39 +10:00
Peter Hutterer
974df9b5ce util: add a list_nth_entry() macro
Returns the nth element for a given list. Note that unlike the other
macros, this takes a type, not a variable as first argument.

Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:09:39 +10:00
Peter Hutterer
036f9fe7ee util: comment the list interface
Copied from libinput commit de70661213a916065dedeefcd617736a9d48da40
with a few fixes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 13:06:11 +10:00
Peter Hutterer
2f2043f24f eis: remove some leftover if 0 code from the server devices
Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 11:30:13 +10:00
Peter Hutterer
ea8b9d3cb8 test: better debugging of event passing
Log when we're passing an event up to the test case, makes tracing
things easier.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 11:30:13 +10:00
Peter Hutterer
9449d66828 test: split the ei tests up into different files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 12:01:05 +10:00
Peter Hutterer
c940c22376 test: rename the main test to eierpecken
Why not have a bit of fun here.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 11:20:30 +10:00
Peter Hutterer
cc78331bba eis: insert an unbind event if we had a bound seat
If our client binds to a seat and then disconnects, insert an unbind
event in the EIS queue to unwind correctly.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 11:20:30 +10:00
Peter Hutterer
358a528478 Add support for seat unbinding
This required a bit of cleanup with the eis device handling.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 11:20:18 +10:00
Peter Hutterer
3e66c87e81 ei: make the device refcounting a bit easier to follow
Once a device is removed, it is moved to the seat's devices_removed
list and the seat's ref is dropped - meaning the seat no longer keeps
the device alive. Once the caller's refcounts drop, the device can be
destroyed.

The device still keeps the seat alive though through a ref.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 11:02:54 +10:00
Peter Hutterer
426c92d59c eis: start the device IDs at 1
device IDs are combined with the seat ID, let's make sure the lower bits
are never 0 to be able to distinquish between a pure seat ID and a
device ID.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-21 11:02:54 +10:00