From 611b9ca84331f3278cfc31e188a86ed117aadb82 Mon Sep 17 00:00:00 2001 From: Moon Sungjoon Date: Wed, 1 Dec 2021 05:40:23 +0900 Subject: [PATCH] backend/wayland: improve wayland input device name Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3332 This makes input device names include it's type name --- backend/wayland/seat.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index 7792d136..c2bac46a 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -468,9 +468,32 @@ struct wlr_wl_input_device *create_wl_input_device( unsigned int vendor = 0, product = 0; - size_t name_size = 8 + strlen(seat->name) + 1; + const char *type_name; + + switch (type) { + case WLR_INPUT_DEVICE_KEYBOARD: + type_name = "keyboard"; + break; + case WLR_INPUT_DEVICE_POINTER: + type_name = "pointer"; + break; + case WLR_INPUT_DEVICE_TOUCH: + type_name = "touch"; + break; + case WLR_INPUT_DEVICE_TABLET_TOOL: + type_name = "tablet-tool"; + break; + case WLR_INPUT_DEVICE_TABLET_PAD: + type_name = "tablet-pad"; + break; + case WLR_INPUT_DEVICE_SWITCH: + type_name = "switch"; + break; + } + + size_t name_size = 8 + strlen(type_name) + strlen(seat->name) + 1; char name[name_size]; - (void) snprintf(name, name_size, "wayland-%s", seat->name); + (void) snprintf(name, name_size, "wayland-%s-%s", type_name, seat->name); wlr_input_device_init(wlr_dev, type, &input_device_impl, name, vendor, product);