mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-03 16:10:11 +01:00
touchpad: move the tap state bug messages to a helper function
There's no need for a custom error message everywhere, it's better to log the current state and the event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8f92b09112
commit
cad73f4023
1 changed files with 15 additions and 10 deletions
|
|
@ -96,6 +96,16 @@ tap_event_to_str(enum tap_event event)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
log_tap_bug(struct tp_dispatch *tp, enum tap_event event)
|
||||
{
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event %s in state %s\n",
|
||||
tap_event_to_str(event),
|
||||
tap_state_to_str(tp->tap.state));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
tp_tap_notify(struct tp_dispatch *tp,
|
||||
uint64_t time,
|
||||
|
|
@ -158,8 +168,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp,
|
|||
case TAP_EVENT_RELEASE:
|
||||
break;
|
||||
case TAP_EVENT_MOTION:
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event, no fingers are down\n");
|
||||
log_tap_bug(tp, event);
|
||||
break;
|
||||
case TAP_EVENT_TIMEOUT:
|
||||
break;
|
||||
|
|
@ -167,8 +176,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp,
|
|||
tp->tap.state = TAP_STATE_DEAD;
|
||||
break;
|
||||
case TAP_EVENT_THUMB:
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event, no fingers down, no thumb\n");
|
||||
log_tap_bug(tp, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -256,8 +264,7 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp,
|
|||
switch (event) {
|
||||
case TAP_EVENT_MOTION:
|
||||
case TAP_EVENT_RELEASE:
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event when fingers are up\n");
|
||||
log_tap_bug(tp, event);
|
||||
break;
|
||||
case TAP_EVENT_TOUCH:
|
||||
tp->tap.state = TAP_STATE_DRAGGING_OR_DOUBLETAP;
|
||||
|
|
@ -592,8 +599,7 @@ tp_tap_multitap_handle_event(struct tp_dispatch *tp,
|
|||
{
|
||||
switch (event) {
|
||||
case TAP_EVENT_RELEASE:
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event, no fingers are down\n");
|
||||
log_tap_bug(tp, event);
|
||||
break;
|
||||
case TAP_EVENT_TOUCH:
|
||||
tp->tap.state = TAP_STATE_MULTITAP_DOWN;
|
||||
|
|
@ -605,8 +611,7 @@ tp_tap_multitap_handle_event(struct tp_dispatch *tp,
|
|||
tp_tap_set_timer(tp, time);
|
||||
break;
|
||||
case TAP_EVENT_MOTION:
|
||||
evdev_log_bug_libinput(tp->device,
|
||||
"invalid tap event, no fingers are down\n");
|
||||
log_tap_bug(tp, event);
|
||||
break;
|
||||
case TAP_EVENT_TIMEOUT:
|
||||
tp->tap.state = TAP_STATE_IDLE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue