eis: only send scroll/button capabilities if the client supports them

Commit a902d5dbd8 ("protocol: replace the capabilities enum with an interface list")
added automatic handling for button/scroll interfaces on the protocol
because the libeis C API didn't have those as separate interfaces yet.
Any EIS implementation with POINTER/POINTER_ABSOLUTE would always
announce BUTTON/SCROLL capabilities.

Later in commit e6954b76d3 ("eis: change the API to match the protocol interfaces closer")
the required C APIs were added but this handling was never removed so an
EIS implementation always replied with button/scroll capabilities even
where not set. Fix this by removing this automatic announcement.

Fixes: e6954b76d3 ("eis: change the API to match the protocol interfaces closer")
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/353>
This commit is contained in:
Peter Hutterer 2025-08-01 14:23:55 +10:00 committed by Marge Bot
parent 7347aeacd2
commit 3b98946b9a

View file

@ -190,14 +190,16 @@ eis_seat_add(struct eis_seat *seat)
mask_add(seat->capabilities.proto_mask, mask);
}
if (seat->capabilities.c_mask & (EIS_DEVICE_CAP_POINTER|EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
(client->interface_versions.ei_pointer > 0 || client->interface_versions.ei_pointer_absolute > 0)) {
if (seat->capabilities.c_mask & EIS_DEVICE_CAP_SCROLL &&
client->interface_versions.ei_scroll > 0) {
uint64_t mask = bit(EIS_SCROLL_INTERFACE_INDEX);
eis_seat_event_capability(seat, mask,
EIS_SCROLL_INTERFACE_NAME);
mask_add(seat->capabilities.proto_mask, mask);
mask = bit(EIS_BUTTON_INTERFACE_INDEX);
}
if (seat->capabilities.c_mask & EIS_DEVICE_CAP_BUTTON &&
client->interface_versions.ei_button > 0) {
uint64_t mask = bit(EIS_BUTTON_INTERFACE_INDEX);
eis_seat_event_capability(seat, mask,
EIS_BUTTON_INTERFACE_NAME);
mask_add(seat->capabilities.proto_mask, mask);