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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 40e5c5d0..88746bed 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -80,6 +80,7 @@ iLocalDef void pushPos_Touch_(iTouch *d, const iFloat3 pos, uint32_t time) {
80struct Impl_Momentum { 80struct Impl_Momentum {
81 iWidget *affinity; 81 iWidget *affinity;
82 uint32_t releaseTime; 82 uint32_t releaseTime;
83 iFloat3 pos;
83 iFloat3 velocity; 84 iFloat3 velocity;
84 iFloat3 accum; 85 iFloat3 accum;
85}; 86};
@@ -226,6 +227,7 @@ static void update_TouchState_(void *ptr) {
226 const iInt2 pixels = initF3_I2(mom->accum); 227 const iInt2 pixels = initF3_I2(mom->accum);
227 if (pixels.x || pixels.y) { 228 if (pixels.x || pixels.y) {
228 subv_F3(&mom->accum, initI2_F3(pixels)); 229 subv_F3(&mom->accum, initI2_F3(pixels));
230 dispatchMotion_Touch_(mom->pos, 0);
229 dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ 231 dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
230 .type = SDL_MOUSEWHEEL, 232 .type = SDL_MOUSEWHEEL,
231 .timestamp = nowTime, 233 .timestamp = nowTime,
@@ -474,6 +476,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
474// pixels.y, y_F3(amount), y_F3(touch->accum)); 476// pixels.y, y_F3(amount), y_F3(touch->accum));
475 if (pixels.x || pixels.y) { 477 if (pixels.x || pixels.y) {
476 setFocus_Widget(NULL); 478 setFocus_Widget(NULL);
479 dispatchMotion_Touch_(touch->pos[0], 0);
477 dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ 480 dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
478 .type = SDL_MOUSEWHEEL, 481 .type = SDL_MOUSEWHEEL,
479 .timestamp = SDL_GetTicks(), 482 .timestamp = SDL_GetTicks(),
@@ -551,6 +554,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
551 iMomentum mom = { 554 iMomentum mom = {
552 .affinity = touch->affinity, 555 .affinity = touch->affinity,
553 .releaseTime = nowTime, 556 .releaseTime = nowTime,
557 .pos = touch->pos[0],
554 .velocity = velocity 558 .velocity = velocity
555 }; 559 };
556 if (isEmpty_Array(d->moms)) { 560 if (isEmpty_Array(d->moms)) {
@@ -569,3 +573,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
569 } 573 }
570 return iTrue; 574 return iTrue;
571} 575}
576
577size_t numFingers_Touch(void) {
578 return size_Array(touchState_()->touches);
579}