Devices should be created by the server
Filing this so it's more public, this is the outcome of a discussion with @jadahl.
Right now, EIS sends seats to the libei client, the client then requests the creation of devices. The latter should be changed so the server creates the devices and the client merely binds to a seat with a set of wanted capabilities, EIS then replies with a list of devices for those. The client binds to those devices and can then send events.
In pseudocode, a libei client would do:
ei = ei_connect()
# bind to all seats with all capabilities
for seat in ei.seats:
seat.bind(seat.capabilities)
ei.sync() # bind() triggers EIS to send a device list
for device in seat:
if device.cap & EI_CAP_RELATIVE:
rel = device
...
rel.send_motion(dx, dy)
This is primarily a protocol change, there shouldn't be a lot of functionality changes in the client.
For relative devices it doesn't have much effect either but for absolute devices it allows the server to reply with an absolute device per screen (which the client cannot otherwise figure out). In the case of a dual-monitor system AB:
+---------------+--------+
| A | B |
| | |
+---------------+ |
| |
+--------+
The device list returned could be:
- one relative device
- one abs device with a screen region of 1920x1080 (possibly with 0,0 offset)
- one abs device with a screen region of 1080x1920 (possibly with 1920,0 offset) As screens change, the devices can be removed and re-added.
This pushes the current aspect ratio calculation to the client which - since it generates the input events - is a better fit than the current approach.
For keyboard devices it removes the ability of the client to set a keymap. Instead, the EIS implementation will either give the client a keymap or say it's a keymap-less device. The client can either handle the server keymap or figure out what to do.