mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-01 09:20:08 +01:00
Fix scroll-threshold check for edge-scrolling to use normalized coordinates
The DEFAULT_SCROLL_THRESHOLD value is a TP_MM_TO_DPI_NORMALIZED value and as
such should be compared to a normalized value. But since commit 8101e43774
("touchpad: switch delta handling to typesafe coordinates"), the
initial_dx / initial_dy values initial_delta points to are no longer in
normalized coordinates, as the result of tp_normalize_delta is now stored
into the normalized value.
This commit changes the check to use the delta pointer which does point to
the normalized x/y values. While at it also use the zero variable to
set normalized to zero rather then manually setting x and y to 0.
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
f893f2bf9b
commit
61721e446a
1 changed files with 3 additions and 7 deletions
|
|
@ -313,7 +313,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
|||
struct tp_touch *t;
|
||||
enum libinput_pointer_axis axis;
|
||||
double *delta;
|
||||
double initial_dx, initial_dy, *initial_delta;
|
||||
double initial_dx, initial_dy;
|
||||
struct normalized_coords normalized;
|
||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||
const struct discrete_coords zero_discrete = { 0.0, 0.0 };
|
||||
|
|
@ -340,12 +340,10 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
|||
case EDGE_RIGHT:
|
||||
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
|
||||
delta = &normalized.y;
|
||||
initial_delta = &initial_dy;
|
||||
break;
|
||||
case EDGE_BOTTOM:
|
||||
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
|
||||
delta = &normalized.x;
|
||||
initial_delta = &initial_dx;
|
||||
break;
|
||||
default: /* EDGE_RIGHT | EDGE_BOTTOM */
|
||||
continue; /* Don't know direction yet, skip */
|
||||
|
|
@ -369,10 +367,8 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
|||
initial_dx,
|
||||
initial_dy,
|
||||
&normalized);
|
||||
if (fabs(*initial_delta) < DEFAULT_SCROLL_THRESHOLD) {
|
||||
normalized.x = 0.0;
|
||||
normalized.y = 0.0;
|
||||
}
|
||||
if (fabs(*delta) < DEFAULT_SCROLL_THRESHOLD)
|
||||
normalized = zero;
|
||||
break;
|
||||
case EDGE_SCROLL_TOUCH_STATE_EDGE:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue