diff options
author | Moon Sungjoon <sumoon@seoulsaram.org> | 2021-12-01 05:40:23 +0900 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-11-30 22:06:14 +0000 |
commit | 611b9ca84331f3278cfc31e188a86ed117aadb82 (patch) | |
tree | 179c0beccc43554f10fbe454a2e0112cf923e422 | |
parent | a44b2af6722397d5750c81cb29d09c4e6a52e546 (diff) |
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
-rw-r--r-- | backend/wayland/seat.c | 27 |
1 files 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); |