aboutsummaryrefslogtreecommitdiffstats
path: root/src/touchhandler/TouchHandler.h
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2023-02-23 13:35:29 +0200
committerRiku Isokoski <riksu9000@gmail.com>2023-02-24 00:05:21 +0200
commit1516b082fd75a1c68d98862199bd349175d37a8f (patch)
tree3d550e490aed8b73075cb13cb7bd6055480a0a1e /src/touchhandler/TouchHandler.h
parent7066ff5aba3d2643a35ba98379ff24143da99c3c (diff)
TouchHandler: Do not store touch panel reference
Diffstat (limited to 'src/touchhandler/TouchHandler.h')
-rw-r--r--src/touchhandler/TouchHandler.h22
1 files changed, 10 insertions, 12 deletions
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;
};
}