touchhandler: Remove LVGL dependency
Move LVGL specific code to the LittleVgl class
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
#include "touchhandler/TouchHandler.h"
|
||||
#ifdef PINETIME_IS_RECOVERY
|
||||
#include "displayapp/DummyLittleVgl.h"
|
||||
#else
|
||||
#include "displayapp/LittleVgl.h"
|
||||
#endif
|
||||
|
||||
using namespace Pinetime::Controllers;
|
||||
using namespace Pinetime::Applications;
|
||||
@@ -32,14 +27,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl& lvgl) : touchPanel {touchPanel}, lvgl {lvgl} {
|
||||
}
|
||||
|
||||
void TouchHandler::CancelTap() {
|
||||
if (info.touching) {
|
||||
isCancelled = true;
|
||||
lvgl.SetNewTouchPoint(-1, -1, true);
|
||||
}
|
||||
TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel) : touchPanel {touchPanel} {
|
||||
}
|
||||
|
||||
Pinetime::Applications::TouchEvents TouchHandler::GestureGet() {
|
||||
@@ -55,6 +43,7 @@ bool TouchHandler::GetNewTouchInfo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only a single gesture per touch
|
||||
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
|
||||
if (gestureReleased) {
|
||||
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown ||
|
||||
@@ -78,18 +67,3 @@ bool TouchHandler::GetNewTouchInfo() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TouchHandler::UpdateLvglTouchPoint() {
|
||||
if (info.touching) {
|
||||
if (!isCancelled) {
|
||||
lvgl.SetNewTouchPoint(info.x, info.y, true);
|
||||
}
|
||||
} else {
|
||||
if (isCancelled) {
|
||||
lvgl.SetNewTouchPoint(-1, -1, false);
|
||||
isCancelled = false;
|
||||
} else {
|
||||
lvgl.SetNewTouchPoint(info.x, info.y, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,10 +3,6 @@
|
||||
#include "displayapp/TouchEvents.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Components {
|
||||
class LittleVgl;
|
||||
}
|
||||
|
||||
namespace Drivers {
|
||||
class Cst816S;
|
||||
}
|
||||
@@ -14,10 +10,9 @@ namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class TouchHandler {
|
||||
public:
|
||||
explicit TouchHandler(Drivers::Cst816S&, Components::LittleVgl&);
|
||||
void CancelTap();
|
||||
explicit TouchHandler(Drivers::Cst816S&);
|
||||
|
||||
bool GetNewTouchInfo();
|
||||
void UpdateLvglTouchPoint();
|
||||
|
||||
bool IsTouching() const {
|
||||
return info.touching;
|
||||
@@ -36,7 +31,6 @@ namespace Pinetime {
|
||||
private:
|
||||
Pinetime::Drivers::Cst816S::TouchInfos info;
|
||||
Pinetime::Drivers::Cst816S& touchPanel;
|
||||
Pinetime::Components::LittleVgl& lvgl;
|
||||
Pinetime::Applications::TouchEvents gesture;
|
||||
bool isCancelled = false;
|
||||
bool gestureReleased = true;
|
||||
|
Reference in New Issue
Block a user