aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorCezary Drożak <cezary@drozak.net>2023-06-16 11:28:30 +0200
committerSimon Ser <contact@emersion.fr>2023-06-16 15:30:04 +0200
commitc08762901e9840d8dca008dcc8d0b5602602fd0a (patch)
treeaa275ee79e2e356ffcd6ebcaf54c417dd47494a5 /sway/input
parent8b4b65d66552d782d2c38a17756baf928b90e670 (diff)
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>
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/libinput.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/input/libinput.c b/sway/input/libinput.c
index dd4fc0be..43875634 100644
--- a/sway/input/libinput.c
+++ b/sway/input/libinput.c
@@ -166,6 +166,18 @@ static bool set_scroll_button(struct libinput_device *dev, uint32_t button) {
return true;
}
+static bool set_scroll_button_lock(struct libinput_device *dev,
+ enum libinput_config_scroll_button_lock_state lock) {
+ uint32_t scroll = libinput_device_config_scroll_get_methods(dev);
+ if ((scroll & ~LIBINPUT_CONFIG_SCROLL_NO_SCROLL) == 0 ||
+ libinput_device_config_scroll_get_button_lock(dev) == lock) {
+ return false;
+ }
+ sway_log(SWAY_DEBUG, "scroll_set_button_lock(%" PRIu32 ")", lock);
+ log_status(libinput_device_config_scroll_set_button_lock(dev, lock));
+ return true;
+}
+
static bool set_dwt(struct libinput_device *device, bool dwt) {
if (!libinput_device_config_dwt_is_available(device) ||
libinput_device_config_dwt_get_enabled(device) == dwt) {
@@ -276,6 +288,9 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device
if (ic->scroll_button != INT_MIN) {
changed |= set_scroll_button(device, ic->scroll_button);
}
+ if (ic->scroll_button_lock != INT_MIN) {
+ changed |= set_scroll_button_lock(device, ic->scroll_button_lock);
+ }
if (ic->dwt != INT_MIN) {
changed |= set_dwt(device, ic->dwt);
}