input/libinput: add scroll_button_lock method

Closes https://github.com/swaywm/sway/issues/6987

Co-authored-by: JJGadgets <git@jjgadgets.tech>
Co-authored-by: DeltaWhy <mike5713@gmail.com>
This commit is contained in:
Cezary Drożak 2023-06-16 11:28:30 +02:00 committed by Simon Ser
parent 8b4b65d665
commit c08762901e
10 changed files with 66 additions and 0 deletions

View file

@ -1019,6 +1019,17 @@ static json_object *describe_libinput_device(struct libinput_device *device) {
uint32_t button = libinput_device_config_scroll_get_button(device);
json_object_object_add(object, "scroll_button",
json_object_new_int(button));
const char *lock = "unknown";
switch (libinput_device_config_scroll_get_button_lock(device)) {
case LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED:
lock = "enabled";
break;
case LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED:
lock = "disabled";
break;
}
json_object_object_add(object, "scroll_button_lock",
json_object_new_string(lock));
}
}