Commit fe20c35be80d1b20e6d977ddd11c02b0488be439

Sylvain Becker 2019-10-14T16:40:46

Fixed race condition when scaling Touch events, and changing the renderer target. Always read the output size of the main renderer. (similar to bug 2107)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index fb770d4..f223d92 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -689,9 +689,13 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
         SDL_FPoint scale;
         GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale);
         if (logical_w) {
-            int w = 1;
-            int h = 1;
-            SDL_GetRendererOutputSize(renderer, &w, &h);
+            int w, h;
+
+            if (renderer->GetOutputSize) {
+                renderer->GetOutputSize(renderer, &w, &h);
+            } else {
+                SDL_GetWindowSize(renderer->window, &w, &h);
+            }
 
             event->tfinger.x *= (w - 1);
             event->tfinger.y *= (h - 1);