From ee9a8dd13c0b87f9ed05e471e745c4c9d84549ba Mon Sep 17 00:00:00 2001 From: Ludovic Desroches Date: Mon, 22 Jan 2024 14:38:31 +0100 Subject: [egt][PATCH 3/3] inputtslib: use pressure instead of pen_down To: egt@microchip.com Use pressure instead of pen_down to handle touch detection. pen_down should be driven by BTN_TOUCH, but it seems we can't rely on it. Most of the tslib examples use the pressure to detect touch events, let's do the same. Caution, it may make obsolete the plugins dealing with the pen detection as we rely on the pressure as well. Signed-off-by: Ludovic Desroches --- src/detail/input/inputtslib.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/detail/input/inputtslib.cpp b/src/detail/input/inputtslib.cpp index aa83fe44..a4243493 100644 --- a/src/detail/input/inputtslib.cpp +++ b/src/detail/input/inputtslib.cpp @@ -120,13 +120,14 @@ void InputTslib::handle_read(const asio::error_code& error) const auto y = samp_mt[j][i].y; const auto slot = samp_mt[j][i].slot; const auto pen_down = samp_mt[j][i].pen_down; + const auto pressure = samp_mt[j][i].pressure; if (egt_unlikely(x < 0 || y < 0)) continue; if (m_active[slot]) { - if (pen_down == 0) + if (pen_down == 0 || pressure == 0) { m_active[slot] = false; @@ -149,7 +150,7 @@ void InputTslib::handle_read(const asio::error_code& error) } else { - if (pen_down == 1) + if (pen_down == 1 || pressure >= 1) { m_last_point[slot] = DisplayPoint(x, y); -- 2.40.1