fix(l2): fast typing - a second finger is a new tap, not a slide

With two thumbs the second lands before the first lifts; the panel's
first point then jumped to it and LVGL saw one press sliding from key to
key, losing the first letter (or starting a scroll). A new GT911 track id
is now a release, then a press. The keyboard no longer hands a rolling
finger to a scroll or gesture up the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-14 12:51:03 +02:00
co-authored by Claude Opus 5.5
parent c779bf46b5
commit 3825dcc077
2 changed files with 16 additions and 0 deletions
@@ -279,6 +279,8 @@ static lv_obj_t* create(lv_obj_t* parent, NodePrefs* prefs) {
lv_obj_add_event_cb(kbd, onLongPress, LV_EVENT_LONG_PRESSED, NULL);
lv_obj_add_event_cb(kbd, onDelete, LV_EVENT_DELETE, NULL);
lv_keyboard_set_popovers(kbd, true);
// A finger rolling on a key is still that key: no scroll or gesture taken up the tree
lv_obj_remove_flag(kbd, (lv_obj_flag_t)(LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_GESTURE_BUBBLE));
apply(kbd, s_script * 2);
return kbd;
}
@@ -173,21 +173,35 @@ static void flushWait(lv_display_t* disp) {
}
#endif
// The first finger only. Typing with two thumbs, the second lands before the
// first lifts; when the first goes the point jumps to the second -- to LVGL
// one press sliding from key to key (the first key lost, or a scroll begun).
// A new finger (the panel's track id) is a release, then a press of its own.
static int16_t s_touch_id = -1; // the finger reported, -1 none
static void touchCb(lv_indev_t* indev, lv_indev_data_t* data) {
(void)indev;
lgfx::touch_point_t tp;
bool down = s_gfx->getTouch(&tp, 1) > 0;
if (s_swallow) {
if (!down) s_swallow = false;
s_touch_id = -1;
data->state = LV_INDEV_STATE_RELEASED;
return;
}
if (down && s_touch_id >= 0 && tp.id != s_touch_id) {
s_touch_id = -1;
data->state = LV_INDEV_STATE_RELEASED; // at the last point; read again for the new finger
data->continue_reading = true;
return;
}
if (down) {
cpuSlow(false); // the frame this touch causes: at the full clock
s_touch_id = tp.id;
data->state = LV_INDEV_STATE_PRESSED;
data->point.x = tp.x;
data->point.y = tp.y;
} else {
s_touch_id = -1;
data->state = LV_INDEV_STATE_RELEASED;
}
}