[PATCH libinput 1/3] Fix scroll-threshold check for edge-scrolling to use normalized coordinates
Hans de Goede
hdegoede at redhat.com
Tue Mar 24 05:14:17 PDT 2015
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 at redhat.com>
---
src/evdev-mt-touchpad-edge-scroll.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index 26d6bbc..d304316 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -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;
--
2.3.3
More information about the wayland-devel
mailing list