File tree 5 files changed +17
-22
lines changed
5 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ namespace Pinetime {
59
59
uint16_t writeOffset = 0 ;
60
60
uint16_t scrollOffset = 0 ;
61
61
62
- lv_point_t touchPoint = {0 };
62
+ lv_point_t touchPoint = {};
63
63
bool tapped = false ;
64
64
bool isCancelled = false ;
65
65
};
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ Pinetime::Controllers::NotificationManager notificationManager;
111
111
Pinetime::Controllers::MotionController motionController;
112
112
Pinetime::Controllers::TimerController timerController;
113
113
Pinetime::Controllers::AlarmController alarmController {dateTimeController};
114
- Pinetime::Controllers::TouchHandler touchHandler (touchPanel) ;
114
+ Pinetime::Controllers::TouchHandler touchHandler;
115
115
Pinetime::Controllers::ButtonHandler buttonHandler;
116
116
Pinetime::Controllers::BrightnessController brightnessController {};
117
117
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ void SystemTask::Work() {
250
250
isDimmed = false ;
251
251
break ;
252
252
case Messages::TouchWakeUp: {
253
- if (touchHandler.GetNewTouchInfo ( )) {
253
+ if (touchHandler.ProcessTouchInfo (touchPanel. GetTouchInfo () )) {
254
254
auto gesture = touchHandler.GestureGet ();
255
255
if (settingsController.GetNotificationStatus () != Controllers::Settings::Notification::Sleep &&
256
256
gesture != Pinetime::Applications::TouchEvents::None &&
@@ -342,7 +342,7 @@ void SystemTask::Work() {
342
342
// TODO add intent of fs access icon or something
343
343
break ;
344
344
case Messages::OnTouchEvent:
345
- if (touchHandler.GetNewTouchInfo ( )) {
345
+ if (touchHandler.ProcessTouchInfo (touchPanel. GetTouchInfo () )) {
346
346
ReloadIdleTimer ();
347
347
displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
348
348
}
Original file line number Diff line number Diff line change @@ -27,18 +27,13 @@ namespace {
27
27
}
28
28
}
29
29
30
- TouchHandler::TouchHandler (Drivers::Cst816S& touchPanel) : touchPanel {touchPanel} {
31
- }
32
-
33
30
Pinetime::Applications::TouchEvents TouchHandler::GestureGet () {
34
31
auto returnGesture = gesture;
35
32
gesture = Pinetime::Applications::TouchEvents::None;
36
33
return returnGesture;
37
34
}
38
35
39
- bool TouchHandler::GetNewTouchInfo () {
40
- info = touchPanel.GetTouchInfo ();
41
-
36
+ bool TouchHandler::ProcessTouchInfo (Drivers::Cst816S::TouchInfos info) {
42
37
if (!info.isValid ) {
43
38
return false ;
44
39
}
@@ -65,5 +60,7 @@ bool TouchHandler::GetNewTouchInfo() {
65
60
gestureReleased = true ;
66
61
}
67
62
63
+ currentTouchPoint = {info.x , info.y , info.touching };
64
+
68
65
return true ;
69
66
}
Original file line number Diff line number Diff line change 3
3
#include " displayapp/TouchEvents.h"
4
4
5
5
namespace Pinetime {
6
- namespace Drivers {
7
- class Cst816S ;
8
- }
9
-
10
6
namespace Controllers {
11
7
class TouchHandler {
12
8
public:
13
- explicit TouchHandler (Drivers::Cst816S&);
9
+ struct TouchPoint {
10
+ int x;
11
+ int y;
12
+ bool touching;
13
+ };
14
14
15
- bool GetNewTouchInfo ( );
15
+ bool ProcessTouchInfo (Drivers::Cst816S::TouchInfos info );
16
16
17
17
bool IsTouching () const {
18
- return info .touching ;
18
+ return currentTouchPoint .touching ;
19
19
}
20
20
21
21
uint8_t GetX () const {
22
- return info .x ;
22
+ return currentTouchPoint .x ;
23
23
}
24
24
25
25
uint8_t GetY () const {
26
- return info .y ;
26
+ return currentTouchPoint .y ;
27
27
}
28
28
29
29
Pinetime::Applications::TouchEvents GestureGet ();
30
30
31
31
private:
32
- Pinetime::Drivers::Cst816S::TouchInfos info;
33
- Pinetime::Drivers::Cst816S& touchPanel;
34
32
Pinetime::Applications::TouchEvents gesture;
35
- bool isCancelled = false ;
33
+ TouchPoint currentTouchPoint = {} ;
36
34
bool gestureReleased = true ;
37
35
};
38
36
}
You can’t perform that action at this time.
0 commit comments