mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 02:20:30 +01:00
touchpad: Remove unnecessary edge scroll threshold variable
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@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
1cebdc7a2b
commit
8ffc213408
2 changed files with 1 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue