Unify touch panel handling
This commit is contained in:
parent
e6ee548536
commit
0076962588
|
@ -6,7 +6,6 @@ namespace Pinetime {
|
||||||
enum class Messages : uint8_t {
|
enum class Messages : uint8_t {
|
||||||
GoToSleep,
|
GoToSleep,
|
||||||
GoToRunning,
|
GoToRunning,
|
||||||
TouchWakeUp,
|
|
||||||
OnNewTime,
|
OnNewTime,
|
||||||
OnNewNotification,
|
OnNewNotification,
|
||||||
OnNewCall,
|
OnNewCall,
|
||||||
|
|
|
@ -198,20 +198,6 @@ void SystemTask::Work() {
|
||||||
case Messages::GoToRunning:
|
case Messages::GoToRunning:
|
||||||
GoToRunning();
|
GoToRunning();
|
||||||
break;
|
break;
|
||||||
case Messages::TouchWakeUp: {
|
|
||||||
if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) {
|
|
||||||
auto gesture = touchHandler.GestureGet();
|
|
||||||
if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep &&
|
|
||||||
gesture != Pinetime::Applications::TouchEvents::None &&
|
|
||||||
((gesture == Pinetime::Applications::TouchEvents::DoubleTap &&
|
|
||||||
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) ||
|
|
||||||
(gesture == Pinetime::Applications::TouchEvents::Tap &&
|
|
||||||
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) {
|
|
||||||
GoToRunning();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Messages::GoToSleep:
|
case Messages::GoToSleep:
|
||||||
GoToSleep();
|
GoToSleep();
|
||||||
break;
|
break;
|
||||||
|
@ -260,8 +246,23 @@ void SystemTask::Work() {
|
||||||
// TODO add intent of fs access icon or something
|
// TODO add intent of fs access icon or something
|
||||||
break;
|
break;
|
||||||
case Messages::OnTouchEvent:
|
case Messages::OnTouchEvent:
|
||||||
if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) {
|
// Finish immediately if no new events
|
||||||
|
if (!touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (state == SystemTaskState::Running) {
|
||||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
|
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
|
||||||
|
} else {
|
||||||
|
// If asleep, check for touch panel wake triggers
|
||||||
|
auto gesture = touchHandler.GestureGet();
|
||||||
|
if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep &&
|
||||||
|
gesture != Pinetime::Applications::TouchEvents::None &&
|
||||||
|
((gesture == Pinetime::Applications::TouchEvents::DoubleTap &&
|
||||||
|
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) ||
|
||||||
|
(gesture == Pinetime::Applications::TouchEvents::Tap &&
|
||||||
|
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) {
|
||||||
|
GoToRunning();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Messages::HandleButtonEvent: {
|
case Messages::HandleButtonEvent: {
|
||||||
|
@ -493,14 +494,7 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTask::OnTouchEvent() {
|
void SystemTask::OnTouchEvent() {
|
||||||
if (state == SystemTaskState::Running) {
|
|
||||||
PushMessage(Messages::OnTouchEvent);
|
PushMessage(Messages::OnTouchEvent);
|
||||||
} else {
|
|
||||||
if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap) or
|
|
||||||
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
|
|
||||||
PushMessage(Messages::TouchWakeUp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTask::PushMessage(System::Messages msg) {
|
void SystemTask::PushMessage(System::Messages msg) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user