File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -487,6 +487,12 @@ Pawn::Pawn(AppControllers& controllers) : controllers(controllers) {
487487 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this );
488488 Refresh ();
489489 }
490+ if (amx_FindPublic (&amx, " @touch" , &touch_index) != AMX_ERR_NONE) {
491+ touch_index = -1 ;
492+ }
493+ if (amx_FindPublic (&amx, " @gesture" , &gesture_index) != AMX_ERR_NONE) {
494+ gesture_index = -1 ;
495+ }
490496}
491497
492498void Pawn::CleanUI () {
@@ -574,3 +580,38 @@ void Pawn::QueueError(unsigned int amx_err) {
574580 },
575581 this );
576582}
583+
584+ bool Pawn::OnTouchEvent (TouchEvents event) {
585+ if (gesture_index < 0 )
586+ return false ;
587+
588+ cell ret;
589+
590+ amx_Push (&amx, (cell)event);
591+
592+ int result = amx_Exec (&amx, &ret, gesture_index);
593+ if (result != AMX_ERR_NONE) {
594+ ShowError (result);
595+ return true ;
596+ }
597+
598+ return ret != 0 ;
599+ }
600+
601+ bool Pawn::OnTouchEvent (uint16_t x, uint16_t y) {
602+ if (touch_index < 0 )
603+ return false ;
604+
605+ cell ret;
606+
607+ amx_Push (&amx, y);
608+ amx_Push (&amx, x);
609+
610+ int result = amx_Exec (&amx, &ret, touch_index);
611+ if (result != AMX_ERR_NONE) {
612+ ShowError (result);
613+ return true ;
614+ }
615+
616+ return ret != 0 ;
617+ }
Original file line number Diff line number Diff line change @@ -25,14 +25,17 @@ namespace Pinetime {
2525 void ShowError (unsigned int amx_err);
2626 void ShowError (const char * msg);
2727
28+ bool OnTouchEvent (TouchEvents event) override ;
29+ bool OnTouchEvent (uint16_t x, uint16_t y) override ;
30+
2831 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
2932 AppControllers& controllers;
3033
3134 Widgets::StatusIcons* statusIcons = nullptr ;
3235
3336 private:
3437 AMX amx;
35- int refresh_index;
38+ int refresh_index, touch_index, gesture_index ;
3639 lv_task_t * taskRefresh = 0 ;
3740 unsigned int queued_error = 0 ;
3841
You can’t perform that action at this time.
0 commit comments