Skip to content

Commit

Permalink
Fixed race condition when scaling Touch events, and changing the rend…
Browse files Browse the repository at this point in the history
…erer

target.
Always read the output size of the main renderer.
(similar to bug 2107)
  • Loading branch information
1bsyl committed Oct 14, 2019
1 parent 074f6a5 commit fe20c35
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/render/SDL_render.c
Expand Up @@ -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);
Expand Down

0 comments on commit fe20c35

Please sign in to comment.