[PATCH libinput] touchpad: Remove unnecessary edge scroll threshold variable
Hans de Goede
hdegoede at redhat.com
Mon Mar 9 06:22:56 PDT 2015
Now that we've separate handling of the EDGE_NEW vs EDGE states in
tp_edge_scroll_post_events() we can drop the threshold variable, in EDGE_NEW
we always want to check against DEFAULT_SCROLL_THRESHOLD and in the EDGE
state we only want to make sure that the delta != 0.0 which is already
checked later on in tp_edge_scroll_post_events().
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/evdev-mt-touchpad-edge-scroll.c | 7 +------
src/evdev-mt-touchpad.h | 1 -
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index 3adde8c..a7936b6 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -73,7 +73,6 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp,
switch (state) {
case EDGE_SCROLL_TOUCH_STATE_NONE:
t->scroll.edge = EDGE_NONE;
- t->scroll.threshold = DEFAULT_SCROLL_THRESHOLD;
break;
case EDGE_SCROLL_TOUCH_STATE_EDGE_NEW:
t->scroll.edge = tp_touch_get_edge(tp, t);
@@ -83,7 +82,6 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp,
t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT);
break;
case EDGE_SCROLL_TOUCH_STATE_EDGE:
- t->scroll.threshold = 0.01; /* Do not allow 0.0 events */
break;
case EDGE_SCROLL_TOUCH_STATE_AREA:
t->scroll.edge = EDGE_NONE;
@@ -265,7 +263,6 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
tp_for_each_touch(tp, t) {
t->scroll.direction = -1;
- t->scroll.threshold = DEFAULT_SCROLL_THRESHOLD;
libinput_timer_init(&t->scroll.timer,
device->base.seat->libinput,
tp_edge_scroll_handle_timeout, t);
@@ -367,7 +364,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
tp_normalize_delta(tp,
&initial_dx,
&initial_dy);
- if (fabs(*initial_delta) < t->scroll.threshold) {
+ if (fabs(*initial_delta) < DEFAULT_SCROLL_THRESHOLD) {
dx = 0.0;
dy = 0.0;
} else {
@@ -376,8 +373,6 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
}
break;
case EDGE_SCROLL_TOUCH_STATE_EDGE:
- if (fabs(*delta) < t->scroll.threshold)
- *delta = 0.0;
break;
}
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 57b3370..f88fc4a 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -173,7 +173,6 @@ struct tp_touch {
enum tp_edge_scroll_touch_state edge_state;
uint32_t edge;
int direction;
- double threshold;
struct libinput_timer timer;
int32_t initial_x; /* in device coordinates */
int32_t initial_y; /* in device coordinates */
--
2.3.1
More information about the wayland-devel
mailing list