From 3b98946b9a94b76c6109a3045f994b9ed0269302 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 1 Aug 2025 14:23:55 +1000 Subject: [PATCH] eis: only send scroll/button capabilities if the client supports them Commit a902d5dbd859 ("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 e6954b76d3b4 ("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: e6954b76d3b4 ("eis: change the API to match the protocol interfaces closer") Part-of: --- src/libeis-seat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libeis-seat.c b/src/libeis-seat.c index a88d447..bca387e 100644 --- a/src/libeis-seat.c +++ b/src/libeis-seat.c @@ -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);