diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 5 | ||||
-rw-r--r-- | src/ui/touch.c | 6 | ||||
-rw-r--r-- | src/ui/touch.h | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index e63e4636..2bce16e8 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -5267,14 +5267,15 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
5267 | destroy_Widget(d->copyMenu); | 5267 | destroy_Widget(d->copyMenu); |
5268 | d->copyMenu = NULL; | 5268 | d->copyMenu = NULL; |
5269 | } | 5269 | } |
5270 | d->copyMenu = makeMenu_Widget(w, (iMenuItem[]){ | 5270 | const iMenuItem items[] = { |
5271 | { clipCopy_Icon " ${menu.copy}", 0, 0, "copy" }, | 5271 | { clipCopy_Icon " ${menu.copy}", 0, 0, "copy" }, |
5272 | #if defined (iPlatformAppleMobile) | 5272 | #if defined (iPlatformAppleMobile) |
5273 | { export_Icon " ${menu.share}", 0, 0, "copy share:1" }, | 5273 | { export_Icon " ${menu.share}", 0, 0, "copy share:1" }, |
5274 | #endif | 5274 | #endif |
5275 | { "---" }, | 5275 | { "---" }, |
5276 | { close_Icon " ${menu.select.clear}", 0, 0, "document.select arg:0" }, | 5276 | { close_Icon " ${menu.select.clear}", 0, 0, "document.select arg:0" }, |
5277 | }, 3); | 5277 | }; |
5278 | d->copyMenu = makeMenu_Widget(w, items, iElemCount(items)); | ||
5278 | setFlags_Widget(d->copyMenu, noFadeBackground_WidgetFlag, iTrue); | 5279 | setFlags_Widget(d->copyMenu, noFadeBackground_WidgetFlag, iTrue); |
5279 | openMenu_Widget(d->copyMenu, pos_Click(&d->click)); | 5280 | openMenu_Widget(d->copyMenu, pos_Click(&d->click)); |
5280 | return iTrue; | 5281 | return iTrue; |
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 | ||
116 | static iTouchState *touchState_(void) { | 117 | static 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 | ||
843 | iInt2 latestTapPosition_Touch(void) { | ||
844 | return touchState_()->latestLongPressStartPos; | ||
845 | } | ||
846 | |||
841 | iBool isHovering_Touch(void) { | 847 | iBool isHovering_Touch(void) { |
842 | iTouchState *d = touchState_(); | 848 | iTouchState *d = touchState_(); |
843 | if (numFingers_Touch() == 1) { | 849 | if (numFingers_Touch() == 1) { |
diff --git a/src/ui/touch.h b/src/ui/touch.h index 9c45fcb1..15c6da1f 100644 --- a/src/ui/touch.h +++ b/src/ui/touch.h | |||
@@ -42,5 +42,6 @@ void widgetDestroyed_Touch (iWidget *widget); | |||
42 | void transferAffinity_Touch (iWidget *src, iWidget *dst); | 42 | void transferAffinity_Touch (iWidget *src, iWidget *dst); |
43 | 43 | ||
44 | iInt2 latestPosition_Touch (void); /* valid during processing of current event */ | 44 | iInt2 latestPosition_Touch (void); /* valid during processing of current event */ |
45 | iInt2 latestTapPosition_Touch (void); | ||
45 | iBool isHovering_Touch (void); /* stationary touch or a long-press drag ongoing */ | 46 | iBool isHovering_Touch (void); /* stationary touch or a long-press drag ongoing */ |
46 | size_t numFingers_Touch (void); | 47 | size_t numFingers_Touch (void); |