summaryrefslogtreecommitdiff
path: root/src/ui/touch.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-15 22:38:13 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-15 22:38:13 +0300
commitafce90c9f6b52db97de29824d1afd1a0742550df (patch)
treec22eeafe577995215ef6edf448a35f8d8328cb8d /src/ui/touch.c
parentd268545d12db5b02ee5975acb311d5b3cd875d6a (diff)
Mobile: Various improvements and fixes
- fill the safe area with theme background - don't set button hover states if dragging/scrolling - edge-draggable widgets must be flagged as such - Preferences top panel offset matches sibling panels' offset - allow toolbar to unhide when document is not scrollable
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r--src/ui/touch.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index f1aa8f06..c373ebd3 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -340,7 +340,7 @@ static void update_TouchState_(void *ptr) {
340 340
341static iWidget *findSlidePanel_Widget_(iWidget *d) { 341static iWidget *findSlidePanel_Widget_(iWidget *d) {
342 for (iWidget *w = d; w; w = parent_Widget(w)) { 342 for (iWidget *w = d; w; w = parent_Widget(w)) {
343 if (isVisible_Widget(w) && flags_Widget(w) & horizontalOffset_WidgetFlag) { 343 if (isVisible_Widget(w) && flags_Widget(w) & edgeDraggable_WidgetFlag) {
344 return w; 344 return w;
345 } 345 }
346 } 346 }
@@ -453,6 +453,8 @@ iBool processEvent_Touch(const SDL_Event *ev) {
453 if (edge == left_TouchEdge) { 453 if (edge == left_TouchEdge) {
454 dragging = findSlidePanel_Widget_(aff); 454 dragging = findSlidePanel_Widget_(aff);
455 if (dragging) { 455 if (dragging) {
456 printf("Selected for dragging: ");
457 identify_Widget(dragging);
456 setFlags_Widget(dragging, dragged_WidgetFlag, iTrue); 458 setFlags_Widget(dragging, dragged_WidgetFlag, iTrue);
457 } 459 }
458 } 460 }
@@ -745,6 +747,20 @@ iInt2 latestPosition_Touch(void) {
745 return touchState_()->currentTouchPos; 747 return touchState_()->currentTouchPos;
746} 748}
747 749
750iBool isHovering_Touch(void) {
751 iTouchState *d = touchState_();
752 if (numFingers_Touch() == 1) {
753 const iTouch *touch = constFront_Array(d->touches);
754 if (touch->isTapBegun && isStationary_Touch_(touch)) {
755 return iTrue;
756 }
757 if (touch->isTapAndHold) {
758 return iTrue;
759 }
760 }
761 return iFalse;
762}
763
748size_t numFingers_Touch(void) { 764size_t numFingers_Touch(void) {
749 return size_Array(touchState_()->touches); 765 return size_Array(touchState_()->touches);
750} 766}