Fetch input device vendor/product from libinput

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4582
This commit is contained in:
Simon Ser 2024-03-07 12:16:11 +01:00 committed by Simon Zeni
parent 59f6292383
commit f2a0e81b24
2 changed files with 13 additions and 6 deletions

View file

@ -65,8 +65,15 @@ struct sway_seat *input_manager_sway_seat_from_wlr_seat(struct wlr_seat *wlr_sea
}
char *input_device_get_identifier(struct wlr_input_device *device) {
int vendor = device->vendor;
int product = device->product;
int vendor = 0, product = 0;
#if WLR_HAS_LIBINPUT_BACKEND
if (wlr_input_device_is_libinput(device)) {
struct libinput_device *libinput_dev = wlr_libinput_get_device_handle(device);
vendor = libinput_device_get_id_vendor(libinput_dev);
product = libinput_device_get_id_product(libinput_dev);
}
#endif
char *name = strdup(device->name ? device->name : "");
strip_whitespace(name);