mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 07:08:01 +02:00
gestures: don't handle SWIPE if we transitioned from SWIPE_START
If we get to SWIPE_START we send out the BEGIN event and transition to state SWIPE. We must not process that state immediately to avoid sending out a spurious UPDATE event when nothing has changed. Same for the PINCH_START/PINCH and SCROLL_START/SCROLL states. This also fixes a crasher where we end up with NaN in the custom acceleration function because passing the same timestamp in twice causes a division by zero (delta time is zero). Closes #1053 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1088>
This commit is contained in:
parent
84225f28b6
commit
c3aa00ef90
1 changed files with 11 additions and 10 deletions
|
|
@ -1488,18 +1488,13 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time,
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
transitions[idx++] = tp->gesture.state;
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
if (tp->gesture.state == GESTURE_STATE_SCROLL_START) {
|
|
||||||
tp_gesture_handle_state_scroll_start(tp, time);
|
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
|
||||||
transitions[idx++] = tp->gesture.state;
|
|
||||||
}
|
|
||||||
if (tp->gesture.state == GESTURE_STATE_SCROLL) {
|
if (tp->gesture.state == GESTURE_STATE_SCROLL) {
|
||||||
tp_gesture_handle_state_scroll(tp, time);
|
tp_gesture_handle_state_scroll(tp, time);
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
transitions[idx++] = tp->gesture.state;
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
if (tp->gesture.state == GESTURE_STATE_SWIPE_START) {
|
if (tp->gesture.state == GESTURE_STATE_SCROLL_START) {
|
||||||
tp_gesture_handle_state_swipe_start(tp, time);
|
tp_gesture_handle_state_scroll_start(tp, time);
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
transitions[idx++] = tp->gesture.state;
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
|
|
@ -1508,15 +1503,21 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time,
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
transitions[idx++] = tp->gesture.state;
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
if (tp->gesture.state == GESTURE_STATE_PINCH_START) {
|
if (tp->gesture.state == GESTURE_STATE_SWIPE_START) {
|
||||||
tp_gesture_handle_state_pinch_start(tp, time);
|
tp_gesture_handle_state_swipe_start(tp, time);
|
||||||
if (transitions[idx - 1] != tp->gesture.state)
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
transitions[idx++] = tp->gesture.state;
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
if (tp->gesture.state == GESTURE_STATE_PINCH) {
|
if (tp->gesture.state == GESTURE_STATE_PINCH) {
|
||||||
tp_gesture_handle_state_pinch(tp, time);
|
tp_gesture_handle_state_pinch(tp, time);
|
||||||
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
|
transitions[idx++] = tp->gesture.state;
|
||||||
|
}
|
||||||
|
if (tp->gesture.state == GESTURE_STATE_PINCH_START) {
|
||||||
|
tp_gesture_handle_state_pinch_start(tp, time);
|
||||||
|
if (transitions[idx - 1] != tp->gesture.state)
|
||||||
|
transitions[idx++] = tp->gesture.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldstate != tp->gesture.state) {
|
if (oldstate != tp->gesture.state) {
|
||||||
char buf[1024] = {0};
|
char buf[1024] = {0};
|
||||||
size_t remaining = sizeof(buf);
|
size_t remaining = sizeof(buf);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue