mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-22 22:00:36 +01:00
touchpad: Fix sending of scroll stop events
Setting tp->scroll.direction = 0 before checking tp->scroll.direction to see if we need to send stop scroll events for vert / horz scrolling does not really work well. Also we need to check direction with an axis mask, not the axis number. While at it also add a tp_stop_scroll_events() helper function for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cee3a482f3
commit
ecb132fef6
1 changed files with 23 additions and 16 deletions
|
|
@ -500,6 +500,28 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tp_stop_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
||||
{
|
||||
if (tp->scroll.state == SCROLL_STATE_NONE)
|
||||
return;
|
||||
|
||||
/* terminate scrolling with a zero scroll event */
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL))
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
||||
0);
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL))
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||
0);
|
||||
|
||||
tp->scroll.state = SCROLL_STATE_NONE;
|
||||
tp->scroll.direction = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
||||
{
|
||||
|
|
@ -513,22 +535,7 @@ tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
|||
}
|
||||
|
||||
if (nfingers_down != 2) {
|
||||
/* terminate scrolling with a zero scroll event to notify
|
||||
* caller that it really ended now */
|
||||
if (tp->scroll.state != SCROLL_STATE_NONE) {
|
||||
tp->scroll.state = SCROLL_STATE_NONE;
|
||||
tp->scroll.direction = 0;
|
||||
if (tp->scroll.direction & LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL)
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
||||
0);
|
||||
if (tp->scroll.direction & LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL)
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||
0);
|
||||
}
|
||||
tp_stop_scroll_events(tp, time);
|
||||
} else {
|
||||
tp_post_twofinger_scroll(tp, time);
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue