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)
This commit is contained in:
Sylvain Becker 2019-10-14 16:40:46 +02:00
parent 074f6a512d
commit fe20c35be8

View file

@ -689,9 +689,13 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
SDL_FPoint scale; SDL_FPoint scale;
GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale);
if (logical_w) { if (logical_w) {
int w = 1; int w, h;
int h = 1;
SDL_GetRendererOutputSize(renderer, &w, &h); if (renderer->GetOutputSize) {
renderer->GetOutputSize(renderer, &w, &h);
} else {
SDL_GetWindowSize(renderer->window, &w, &h);
}
event->tfinger.x *= (w - 1); event->tfinger.x *= (w - 1);
event->tfinger.y *= (h - 1); event->tfinger.y *= (h - 1);