mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-05 21:38:09 +02:00
touchpad: add gesture state debug helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cbaa79cfdb
commit
aab4ccac5c
1 changed files with 21 additions and 0 deletions
|
|
@ -32,6 +32,20 @@
|
|||
#define DEFAULT_GESTURE_SWITCH_TIMEOUT 100 /* ms */
|
||||
#define DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT 1000 /* ms */
|
||||
|
||||
#define CASE_RETURN_STRING(a) case a: return #a
|
||||
|
||||
static inline const char*
|
||||
gesture_state_to_str(enum tp_gesture_2fg_state state)
|
||||
{
|
||||
switch (state) {
|
||||
CASE_RETURN_STRING(GESTURE_2FG_STATE_NONE);
|
||||
CASE_RETURN_STRING(GESTURE_2FG_STATE_UNKNOWN);
|
||||
CASE_RETURN_STRING(GESTURE_2FG_STATE_SCROLL);
|
||||
CASE_RETURN_STRING(GESTURE_2FG_STATE_PINCH);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct normalized_coords
|
||||
tp_get_touches_delta(struct tp_dispatch *tp, bool average)
|
||||
{
|
||||
|
|
@ -380,6 +394,8 @@ tp_gesture_twofinger_handle_state_pinch(struct tp_dispatch *tp, uint64_t time)
|
|||
static void
|
||||
tp_gesture_post_twofinger(struct tp_dispatch *tp, uint64_t time)
|
||||
{
|
||||
enum tp_gesture_2fg_state oldstate = tp->gesture.twofinger_state;
|
||||
|
||||
if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_NONE)
|
||||
tp->gesture.twofinger_state =
|
||||
tp_gesture_twofinger_handle_state_none(tp, time);
|
||||
|
|
@ -395,6 +411,11 @@ tp_gesture_post_twofinger(struct tp_dispatch *tp, uint64_t time)
|
|||
if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_PINCH)
|
||||
tp->gesture.twofinger_state =
|
||||
tp_gesture_twofinger_handle_state_pinch(tp, time);
|
||||
|
||||
log_debug(tp_libinput_context(tp),
|
||||
"gesture state: %s → %s\n",
|
||||
gesture_state_to_str(oldstate),
|
||||
gesture_state_to_str(tp->gesture.twofinger_state));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue