summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-11-19 11:22:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-11-20 08:10:39 +1000
commitc7bf6fb0e27a70f315ea9dcab79e9b62595f616e (patch)
tree2de0168a2d0159b4a34702d36f0c943295ad5e76
parent617bab373132ac7532a1476b5a9f30dc053f28cb (diff)
downloadlibinput-c7bf6fb0e27a70f315ea9dcab79e9b62595f616e.tar.gz
Allow for a 0 button on button scrolling
This effectively disables the button scrolling, but since 0 is the default button for most devices, we should allow setting the default button. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/libinput.c2
-rw-r--r--src/libinput.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libinput.c b/src/libinput.c
index 202c239a..3f5370fa 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1591,7 +1591,7 @@ libinput_device_config_scroll_set_button(struct libinput_device *device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) == 0)
return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
- if (!libinput_device_has_button(device, button))
+ if (button && !libinput_device_has_button(device, button))
return LIBINPUT_CONFIG_STATUS_INVALID;
return device->config.scroll_mode->set_button(device, button);
diff --git a/src/libinput.h b/src/libinput.h
index 1536b97c..3b39c964 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -2169,6 +2169,8 @@ libinput_device_config_scroll_get_default_mode(struct libinput_device *device);
* @note Setting the button does not change the scroll mode. To change the
* scroll mode call libinput_device_config_scroll_set_mode().
*
+ * If the button is 0, button scrolling is effectively disabled.
+ *
* @param device The device to configure
* @param button The button which when pressed switches to sending scroll events
*