summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Becker <sylvain.becker@gmail.com>2019-04-02 17:10:29 +0200
committerSylvain Becker <sylvain.becker@gmail.com>2019-04-02 17:10:29 +0200
commite79b318ab206b5de718fe9156738b43bd647726f (patch)
treeeb2c016ead8b49d1e2546863046cd464c178538f
parent918255301aed2a13c808a5c816cb9c81f4d850eb (diff)
Bug 4576: remove touch/mouse duplication for Emscripten
-rw-r--r--src/video/emscripten/SDL_emscriptenevents.c17
-rw-r--r--src/video/emscripten/SDL_emscriptenvideo.h3
2 files changed, 0 insertions, 20 deletions
diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 9f99828a8c..82fef9e5c4 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -446,7 +446,6 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
for (i = 0; i < touchEvent->numTouches; i++) {
SDL_FingerID id;
float x, y;
- int mx, my;
if (!touchEvent->touches[i].isChanged)
continue;
@@ -455,16 +454,7 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
x = touchEvent->touches[i].canvasX / client_w;
y = touchEvent->touches[i].canvasY / client_h;
- mx = x * window_data->window->w;
- my = y * window_data->window->h;
-
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
- if (!window_data->finger_touching) {
- window_data->finger_touching = SDL_TRUE;
- window_data->first_finger = id;
- SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my);
- SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
- }
SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f);
/* disable browser scrolling/pinch-to-zoom if app handles touch events */
@@ -472,15 +462,8 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
preventDefault = 1;
}
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
- if ((window_data->finger_touching) && (window_data->first_finger == id)) {
- SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my);
- }
SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
} else {
- if ((window_data->finger_touching) && (window_data->first_finger == id)) {
- SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
- window_data->finger_touching = SDL_FALSE;
- }
SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f);
/* block browser's simulated mousedown/mouseup on touchscreen devices */
diff --git a/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h
index 31565fbd4b..feca1ba3c8 100644
--- a/src/video/emscripten/SDL_emscriptenvideo.h
+++ b/src/video/emscripten/SDL_emscriptenvideo.h
@@ -47,9 +47,6 @@ typedef struct SDL_WindowData
int requested_fullscreen_mode;
SDL_bool fullscreen_resize;
- SDL_bool finger_touching; /* for mapping touch events to mice */
- SDL_FingerID first_finger;
-
SDL_bool has_pointer_lock;
} SDL_WindowData;