diff options
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r-- | src/ui/touch.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c index 195d1dff..aee5a383 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -589,9 +589,18 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
589 | divvf_F3(&touch->accum, 6); | 589 | divvf_F3(&touch->accum, 6); |
590 | divfv_I2(&pixels, 6); | 590 | divfv_I2(&pixels, 6); |
591 | /* Allow scrolling a scrollable widget. */ | 591 | /* Allow scrolling a scrollable widget. */ |
592 | iWidget *flow = findOverflowScrollable_Widget(touch->affinity); | 592 | if (touch->affinity && touch->affinity->flags2 & slidingSheetDraggable_WidgetFlag2) { |
593 | if (flow) { | 593 | extern iWidgetClass Class_SidebarWidget; /* The only type of sliding sheet for now. */ |
594 | touch->affinity = flow; | 594 | iWidget *slider = findParentClass_Widget(touch->affinity, &Class_SidebarWidget); |
595 | if (slider) { | ||
596 | touch->affinity = slider; | ||
597 | } | ||
598 | } | ||
599 | else { | ||
600 | iWidget *flow = findOverflowScrollable_Widget(touch->affinity); | ||
601 | if (flow) { | ||
602 | touch->affinity = flow; | ||
603 | } | ||
595 | } | 604 | } |
596 | } | 605 | } |
597 | else { | 606 | else { |
@@ -617,11 +626,13 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
617 | if (touch->axis == y_TouchAxis) { | 626 | if (touch->axis == y_TouchAxis) { |
618 | pixels.x = 0; | 627 | pixels.x = 0; |
619 | } | 628 | } |
620 | // printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n", | 629 | #if 0 |
621 | // touch->affinity, | 630 | printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n", |
622 | // class_Widget(touch->affinity)->name, | 631 | touch->affinity, |
623 | // pixels.y, y_F3(amount), y_F3(touch->accum), | 632 | class_Widget(touch->affinity)->name, |
624 | // touch->edge); | 633 | pixels.y, y_F3(amount), y_F3(touch->accum), |
634 | touch->edge); | ||
635 | #endif | ||
625 | if (pixels.x || pixels.y) { | 636 | if (pixels.x || pixels.y) { |
626 | //setFocus_Widget(NULL); | 637 | //setFocus_Widget(NULL); |
627 | dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0); | 638 | dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0); |
@@ -801,6 +812,16 @@ void widgetDestroyed_Touch(iWidget *widget) { | |||
801 | } | 812 | } |
802 | } | 813 | } |
803 | 814 | ||
815 | void transferAffinity_Touch(iWidget *src, iWidget *dst) { | ||
816 | iTouchState *d = touchState_(); | ||
817 | iForEach(Array, i, d->touches) { | ||
818 | iTouch *touch = i.value; | ||
819 | if (touch->affinity == src) { | ||
820 | touch->affinity = dst; | ||
821 | } | ||
822 | } | ||
823 | } | ||
824 | |||
804 | iInt2 latestPosition_Touch(void) { | 825 | iInt2 latestPosition_Touch(void) { |
805 | return touchState_()->currentTouchPos; | 826 | return touchState_()->currentTouchPos; |
806 | } | 827 | } |