mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-27 02:10:07 +01:00
evdev: split scroll threshold and direction lock threshold into two
The previous code used a 5mm threshold before axis events were posted. This threshold was on top of the 2mm 2fg threshold (and timeout handling) in the gesture code and effectively prevented events from being sent after a timeout, or in the 2mm-5mm range. We still want a directional lock though, so split the two out. The default 5mm threshold is set to 0 for touchpads since we have our own handling of the threshold there. The directional lock only applies once scrollin has started and remains on 5mm. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
05ce472a05
commit
3dd0ece9c0
3 changed files with 7 additions and 4 deletions
|
|
@ -1628,8 +1628,9 @@ tp_init_scroll(struct tp_dispatch *tp, struct evdev_device *device)
|
|||
tp->scroll.method = tp_scroll_get_default_method(tp);
|
||||
tp->device->base.config.scroll_method = &tp->scroll.config_method;
|
||||
|
||||
/* In mm for touchpads with valid resolution, see tp_init_accel() */
|
||||
tp->device->scroll.threshold = 5.0;
|
||||
/* In mm for touchpads with valid resolution, see tp_init_accel() */
|
||||
tp->device->scroll.threshold = 0.0;
|
||||
tp->device->scroll.direction_lock_threshold = 5.0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2146,6 +2146,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
device->pending_event = EVDEV_NONE;
|
||||
device->devname = libevdev_get_name(device->evdev);
|
||||
device->scroll.threshold = 5.0; /* Default may be overridden */
|
||||
device->scroll.direction_lock_threshold = 5.0; /* Default may be overridden */
|
||||
device->scroll.direction = 0;
|
||||
device->scroll.wheel_click_angle =
|
||||
evdev_read_wheel_click_prop(device);
|
||||
|
|
@ -2414,12 +2415,12 @@ evdev_post_scroll(struct evdev_device *device,
|
|||
trigger speed to start scrolling in the other direction */
|
||||
} else if (!evdev_is_scrolling(device,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
|
||||
if (fabs(delta->y) >= device->scroll.threshold)
|
||||
if (fabs(delta->y) >= device->scroll.direction_lock_threshold)
|
||||
evdev_start_scrolling(device,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||
} else if (!evdev_is_scrolling(device,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
|
||||
if (fabs(delta->x) >= device->scroll.threshold)
|
||||
if (fabs(delta->x) >= device->scroll.direction_lock_threshold)
|
||||
evdev_start_scrolling(device,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ struct evdev_device {
|
|||
void (*change_scroll_method)(struct evdev_device *device);
|
||||
bool button_scroll_active;
|
||||
double threshold;
|
||||
double direction_lock_threshold;
|
||||
uint32_t direction;
|
||||
struct normalized_coords buildup;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue