diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-20 18:44:02 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-20 18:44:02 +0300 |
commit | 851bc03a3ca740dc6879438392a25d8eb8c5a104 (patch) | |
tree | 8b9b49ab41c1c3637addf748d75d1f560940c5e2 /src/ui/touch.c | |
parent | 59a30d880b5af0be7c478123163e819e3b9d1f5f (diff) |
Touch: Fixed motion events
The windowID was expected to be set, but wasn't for touch events.
IssueID #351
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r-- | src/ui/touch.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c index 613f2c0d..884cc605 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -166,6 +166,7 @@ static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) { | |||
166 | .type = SDL_MOUSEMOTION, | 166 | .type = SDL_MOUSEMOTION, |
167 | .timestamp = SDL_GetTicks(), | 167 | .timestamp = SDL_GetTicks(), |
168 | .which = SDL_TOUCH_MOUSEID, | 168 | .which = SDL_TOUCH_MOUSEID, |
169 | .windowID = id_Window(get_Window()), | ||
169 | .state = buttonState, | 170 | .state = buttonState, |
170 | .x = x_F3(pos), | 171 | .x = x_F3(pos), |
171 | .y = y_F3(pos) | 172 | .y = y_F3(pos) |
@@ -183,6 +184,7 @@ static iBool dispatchClick_Touch_(const iTouch *d, int button) { | |||
183 | .state = SDL_PRESSED, | 184 | .state = SDL_PRESSED, |
184 | .timestamp = SDL_GetTicks(), | 185 | .timestamp = SDL_GetTicks(), |
185 | .which = SDL_TOUCH_MOUSEID, | 186 | .which = SDL_TOUCH_MOUSEID, |
187 | .windowID = id_Window(window), | ||
186 | .x = x_F3(tapPos), | 188 | .x = x_F3(tapPos), |
187 | .y = y_F3(tapPos) | 189 | .y = y_F3(tapPos) |
188 | }; | 190 | }; |
@@ -206,6 +208,7 @@ static void dispatchButtonDown_Touch_(iFloat3 pos) { | |||
206 | .clicks = 1, | 208 | .clicks = 1, |
207 | .state = SDL_PRESSED, | 209 | .state = SDL_PRESSED, |
208 | .which = SDL_TOUCH_MOUSEID, | 210 | .which = SDL_TOUCH_MOUSEID, |
211 | .windowID = id_Window(get_Window()), | ||
209 | .button = SDL_BUTTON_LEFT, | 212 | .button = SDL_BUTTON_LEFT, |
210 | .x = x_F3(pos), | 213 | .x = x_F3(pos), |
211 | .y = y_F3(pos) | 214 | .y = y_F3(pos) |
@@ -220,6 +223,7 @@ static void dispatchButtonUp_Touch_(iFloat3 pos) { | |||
220 | .clicks = 1, | 223 | .clicks = 1, |
221 | .state = SDL_RELEASED, | 224 | .state = SDL_RELEASED, |
222 | .which = SDL_TOUCH_MOUSEID, | 225 | .which = SDL_TOUCH_MOUSEID, |
226 | .windowID = id_Window(get_Window()), | ||
223 | .button = SDL_BUTTON_LEFT, | 227 | .button = SDL_BUTTON_LEFT, |
224 | .x = x_F3(pos), | 228 | .x = x_F3(pos), |
225 | .y = y_F3(pos) | 229 | .y = y_F3(pos) |
@@ -351,6 +355,7 @@ static void update_TouchState_(void *ptr) { | |||
351 | dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ | 355 | dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ |
352 | .type = SDL_MOUSEWHEEL, | 356 | .type = SDL_MOUSEWHEEL, |
353 | .which = SDL_TOUCH_MOUSEID, | 357 | .which = SDL_TOUCH_MOUSEID, |
358 | .windowID = id_Window(window_Widget(mom->affinity)), | ||
354 | .timestamp = nowTime, | 359 | .timestamp = nowTime, |
355 | .x = pixels.x, | 360 | .x = pixels.x, |
356 | .y = pixels.y, | 361 | .y = pixels.y, |
@@ -612,11 +617,11 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
612 | if (touch->axis == y_TouchAxis) { | 617 | if (touch->axis == y_TouchAxis) { |
613 | pixels.x = 0; | 618 | pixels.x = 0; |
614 | } | 619 | } |
615 | // printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n", | 620 | printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n", |
616 | // touch->affinity, | 621 | touch->affinity, |
617 | // class_Widget(touch->affinity)->name, | 622 | class_Widget(touch->affinity)->name, |
618 | // pixels.y, y_F3(amount), y_F3(touch->accum), | 623 | pixels.y, y_F3(amount), y_F3(touch->accum), |
619 | // touch->edge); | 624 | touch->edge); |
620 | if (pixels.x || pixels.y) { | 625 | if (pixels.x || pixels.y) { |
621 | //setFocus_Widget(NULL); | 626 | //setFocus_Widget(NULL); |
622 | dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0); | 627 | dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0); |
@@ -624,6 +629,7 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
624 | dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ | 629 | dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ |
625 | .type = SDL_MOUSEWHEEL, | 630 | .type = SDL_MOUSEWHEEL, |
626 | .which = SDL_TOUCH_MOUSEID, | 631 | .which = SDL_TOUCH_MOUSEID, |
632 | .windowID = id_Window(window_Widget(touch->affinity)), | ||
627 | .timestamp = SDL_GetTicks(), | 633 | .timestamp = SDL_GetTicks(), |
628 | .x = pixels.x, | 634 | .x = pixels.x, |
629 | .y = pixels.y, | 635 | .y = pixels.y, |