summaryrefslogtreecommitdiff
path: root/src/ui/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r--src/ui/touch.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 834fe4f8..22f22f9b 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -686,6 +686,9 @@ iBool processEvent_Touch(const SDL_Event *ev) {
686 //dispatchMotion_Touch_(touch->startPos, 0); 686 //dispatchMotion_Touch_(touch->startPos, 0);
687 } 687 }
688 else { 688 else {
689 if (touch->affinity) {
690 dispatchNotification_Touch_(touch, widgetTouchEnds_UserEventCode);
691 }
689 dispatchButtonUp_Touch_(pos); 692 dispatchButtonUp_Touch_(pos);
690 setHover_Widget(NULL); 693 setHover_Widget(NULL);
691 } 694 }
@@ -696,14 +699,34 @@ iBool processEvent_Touch(const SDL_Event *ev) {
696 return iTrue; 699 return iTrue;
697} 700}
698 701
699void stopWidgetMomentum_Touch(iWidget *widget) { 702float stopWidgetMomentum_Touch(const iWidget *widget) {
700 iTouchState *d = touchState_(); 703 iTouchState *d = touchState_();
704 float remaining = 0.0f;
701 iForEach(Array, i, d->moms) { 705 iForEach(Array, i, d->moms) {
702 iMomentum *mom = i.value; 706 iMomentum *mom = i.value;
703 if (mom->affinity == widget) { 707 if (mom->affinity == widget) {
708 remaining = length_F3(mom->velocity);
704 remove_ArrayIterator(&i); 709 remove_ArrayIterator(&i);
705 } 710 }
706 } 711 }
712 return remaining;
713}
714
715enum iWidgetTouchMode widgetMode_Touch(const iWidget *widget) {
716 iTouchState *d = touchState_();
717 iConstForEach(Array, i, d->touches) {
718 const iTouch *touch = i.value;
719 if (touch->affinity == widget) {
720 return touch_WidgetTouchMode;
721 }
722 }
723 iConstForEach(Array, j, d->moms) {
724 const iMomentum *mom = j.value;
725 if (mom->affinity == widget) {
726 return momentum_WidgetTouchMode;
727 }
728 }
729 return none_WidgetTouchMode;
707} 730}
708 731
709void widgetDestroyed_Touch(iWidget *widget) { 732void widgetDestroyed_Touch(iWidget *widget) {