summaryrefslogtreecommitdiff
path: root/src/ui/touch.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 01:00:56 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 01:00:56 +0200
commitce833b32c770475a2668067df878cdd094e2a4a8 (patch)
tree6d306cc2c4713300ebe50456cf38f40549d822db /src/ui/touch.c
parente58fa57545937f4dbfb52b4966623481f733c74f (diff)
iOS: Showing activity views on iPad
On iPad, activity views are popovers and require information about the source. The UI doesn't provide this, though, so just use the long-press tap position for now.
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r--src/ui/touch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 3d318dfb..20ccf7b8 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -111,6 +111,7 @@ struct Impl_TouchState {
111 double momFrictionPerStep; 111 double momFrictionPerStep;
112 double lastMomTime; 112 double lastMomTime;
113 iInt2 currentTouchPos; /* for emulating SDL_GetMouseState() */ 113 iInt2 currentTouchPos; /* for emulating SDL_GetMouseState() */
114 iInt2 latestLongPressStartPos;
114}; 115};
115 116
116static iTouchState *touchState_(void) { 117static iTouchState *touchState_(void) {
@@ -313,6 +314,7 @@ static void update_TouchState_(void *ptr) {
313 } 314 }
314 if (!touch->isTapAndHold && nowTime - touch->startTime >= longPressSpanMs_ && 315 if (!touch->isTapAndHold && nowTime - touch->startTime >= longPressSpanMs_ &&
315 touch->affinity) { 316 touch->affinity) {
317 touchState_()->latestLongPressStartPos = initF3_I2(touch->pos[0]);
316 dispatchClick_Touch_(touch, SDL_BUTTON_RIGHT); 318 dispatchClick_Touch_(touch, SDL_BUTTON_RIGHT);
317 touch->isTapAndHold = iTrue; 319 touch->isTapAndHold = iTrue;
318 touch->hasMoved = iFalse; 320 touch->hasMoved = iFalse;
@@ -838,6 +840,10 @@ iInt2 latestPosition_Touch(void) {
838 return touchState_()->currentTouchPos; 840 return touchState_()->currentTouchPos;
839} 841}
840 842
843iInt2 latestTapPosition_Touch(void) {
844 return touchState_()->latestLongPressStartPos;
845}
846
841iBool isHovering_Touch(void) { 847iBool isHovering_Touch(void) {
842 iTouchState *d = touchState_(); 848 iTouchState *d = touchState_();
843 if (numFingers_Touch() == 1) { 849 if (numFingers_Touch() == 1) {