From 1516b082fd75a1c68d98862199bd349175d37a8f Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 23 Feb 2023 13:35:29 +0200 Subject: TouchHandler: Do not store touch panel reference --- src/touchhandler/TouchHandler.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/touchhandler/TouchHandler.h') diff --git a/src/touchhandler/TouchHandler.h b/src/touchhandler/TouchHandler.h index 9afaa247..a4482255 100644 --- a/src/touchhandler/TouchHandler.h +++ b/src/touchhandler/TouchHandler.h @@ -3,36 +3,34 @@ #include "displayapp/TouchEvents.h" namespace Pinetime { - namespace Drivers { - class Cst816S; - } - namespace Controllers { class TouchHandler { public: - explicit TouchHandler(Drivers::Cst816S&); + struct TouchPoint { + int x; + int y; + bool touching; + }; - bool GetNewTouchInfo(); + bool ProcessTouchInfo(Drivers::Cst816S::TouchInfos info); bool IsTouching() const { - return info.touching; + return currentTouchPoint.touching; } uint8_t GetX() const { - return info.x; + return currentTouchPoint.x; } uint8_t GetY() const { - return info.y; + return currentTouchPoint.y; } Pinetime::Applications::TouchEvents GestureGet(); private: - Pinetime::Drivers::Cst816S::TouchInfos info; - Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Applications::TouchEvents gesture; - bool isCancelled = false; + TouchPoint currentTouchPoint = {}; bool gestureReleased = true; }; } -- cgit v1.2.3-70-g09d2