Add a windowID field to SDL_TouchFingerEvent (bug #4331).

This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
This commit is contained in:
Alex Szpakowski
2019-08-01 18:22:12 -03:00
parent 59ea0735f0
commit d5ec735a33
14 changed files with 74 additions and 49 deletions

View File

@@ -455,16 +455,16 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
y = touchEvent->touches[i].targetY / client_h;
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f);
SDL_SendTouch(deviceId, id, window_data->window, SDL_TRUE, x, y, 1.0f);
/* disable browser scrolling/pinch-to-zoom if app handles touch events */
if (!preventDefault && SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
preventDefault = 1;
}
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
SDL_SendTouchMotion(deviceId, id, window_data->window, x, y, 1.0f);
} else {
SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f);
SDL_SendTouch(deviceId, id, window_data->window, SDL_FALSE, x, y, 1.0f);
/* block browser's simulated mousedown/mouseup on touchscreen devices */
preventDefault = 1;