--- xserver-xorg-input-libinput-0.23.0.orig/include/libinput-properties.h +++ xserver-xorg-input-libinput-0.23.0/include/libinput-properties.h @@ -183,4 +183,7 @@ /* Device rotation: FLOAT, 1 value, 32 bit, read-only */ #define LIBINPUT_PROP_ROTATION_ANGLE_DEFAULT "libinput Rotation Angle Default" +/* Smooth scroll: INT32, 2 values (vertical, horizontal) */ +#define LIBINPUT_PROP_SCROLL_DISTANCE "libinput Scrolling Distance" + #endif /* _LIBINPUT_PROPERTIES_H_ */ --- xserver-xorg-input-libinput-0.23.0.orig/src/xf86libinput.c +++ xserver-xorg-input-libinput-0.23.0/src/xf86libinput.c @@ -1349,7 +1352,6 @@ if (libinput_event_pointer_has_axis(event, axis)) { if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) { value = libinput_event_pointer_get_axis_value_discrete(event, axis); - value *= driver_data->scroll.vdist; } else { value = libinput_event_pointer_get_axis_value(event, axis); } @@ -1363,7 +1365,6 @@ if (libinput_event_pointer_has_axis(event, axis)) { if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) { value = libinput_event_pointer_get_axis_value_discrete(event, axis); - value *= driver_data->scroll.hdist; } else { value = libinput_event_pointer_get_axis_value(event, axis); } @@ -2928,8 +2929,8 @@ pInfo->private = driver_data; driver_data->pInfo = pInfo; - driver_data->scroll.vdist = 15; - driver_data->scroll.hdist = 15; + driver_data->scroll.vdist = 1; + driver_data->scroll.hdist = 1; driver_data->path = path; driver_data->shared_device = shared_device; xorg_list_append(&driver_data->shared_device_link, @@ -3070,6 +3071,7 @@ static Atom prop_sendevents_default; static Atom prop_left_handed; static Atom prop_left_handed_default; +static Atom prop_scroll_dist; static Atom prop_scroll_methods_available; static Atom prop_scroll_method_enabled; static Atom prop_scroll_method_default; @@ -3526,6 +3528,28 @@ } static inline int +LibinputSetPropertyScrollDist(DeviceIntPtr dev, + Atom atom, + XIPropertyValuePtr val, + BOOL checkonly) +{ + if (val->format != 32 || val->type != XA_INTEGER || (val->size != 2 && val->size != 3)) // we accept 3 values for evdev property compat + return BadMatch; + + InputInfoPtr pInfo = dev->public.devicePrivate; + struct xf86libinput *driver_data = pInfo->private; + + if (!checkonly) { + int *data = (int *)val->data; + driver_data->scroll.vdist = data[0]; + driver_data->scroll.hdist = data[1]; + SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.hdist, 0); + SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.vdist, 0); + } + return Success; +} + +static inline int LibinputSetPropertyScrollMethods(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, @@ -3870,6 +3894,8 @@ rc = LibinputSetPropertySendEvents(dev, atom, val, checkonly); else if (atom == prop_left_handed) rc = LibinputSetPropertyLeftHanded(dev, atom, val, checkonly); + else if (atom == prop_scroll_dist) + rc = LibinputSetPropertyScrollDist(dev, atom, val, checkonly); else if (atom == prop_scroll_method_enabled) rc = LibinputSetPropertyScrollMethods(dev, atom, val, checkonly); else if (atom == prop_scroll_button) @@ -3978,6 +4004,21 @@ } static void +LibinputInitScrollDistProperty(DeviceIntPtr dev, + struct xf86libinput *driver_data, + struct libinput_device *device) +{ + int smooth_scroll_values[2] = { + driver_data->scroll.vdist, + driver_data->scroll.hdist + }; + prop_scroll_dist = LibinputMakeProperty(dev, + LIBINPUT_PROP_SCROLL_DISTANCE, + XA_INTEGER, 32, + 2, smooth_scroll_values); +} + +static void LibinputInitTapDragProperty(DeviceIntPtr dev, struct xf86libinput *driver_data, struct libinput_device *device) @@ -4746,6 +4787,7 @@ LibinputInitDisableWhileTypingProperty(dev, driver_data, device); LibinputInitModeGroupProperties(dev, driver_data, device); LibinputInitRotationAngleProperty(dev, driver_data, device); + LibinputInitScrollDistProperty(dev, driver_data, device); /* Device node property, read-only */ device_node = driver_data->path;