diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index e7f823c9d..1ddb62355 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -165,7 +165,8 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } } } else if (event->type == SDL_MOUSEMOTION) { - if (renderer->logical_w) { + SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); + if (renderer->logical_w && window == renderer->window) { event->motion.x -= renderer->viewport.x; event->motion.y -= renderer->viewport.y; event->motion.x = (int)(event->motion.x / renderer->scale.x); @@ -183,7 +184,8 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } } else if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEBUTTONUP) { - if (renderer->logical_w) { + SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); + if (renderer->logical_w && window == renderer->window) { event->button.x -= renderer->viewport.x; event->button.y -= renderer->viewport.y; event->button.x = (int)(event->button.x / renderer->scale.x);