SDL/src
Sam Lantinga 6a3ad8a998 Fixed bug 2367 - Bad mouse motion coordinates with two windows where one has changed logical size
Andreas Ragnerstam

I have two windows where one has a renderer where the logical size has been changed with SDL_RenderSetLogicalSize. When I get SDL_MOUSEMOTION events belonging to the non-scaled window these will have been scaled with the factor of the scaled window, which is not expected.

Adding some printf debugging to SDL_RendererEventWatch of SDL_render.c, where (event->type == SDL_MOUSEMOTION), I found that for every mouse motion SDL_RendererEventWatch is called twice and the event->motion.x and event.motion.y are set twice for the event, once for each renderer where only the last one set will be saved to the event struct. This will work fine if both renderers have the same scale, but otherwise the motion coordinates will be scaled for the renderer belonging to another window than the mouse was moved in.

I guess one solution would be to check that window == renderer->window for SDL_MOUSEMOTION events, similar to what is done for when SDL_WINDOWEVENT events.

I get the same error on both X11 and Windows.
The same problem also exists for SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP events.
2015-05-28 12:18:05 -07:00
..
atomic Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
audio Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
core [IBus] Only register interest in messages sent to our input context. 2015-02-27 21:17:29 +00:00
cpuinfo Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
dynapi Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
events Added some unknown keys from Japanese 106/109 keyboards (thanks, "ver0hiro"!). 2015-05-26 20:55:03 -04:00
file Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
filesystem Fixed compiling and tested on Windows 2015-05-28 12:06:48 -07:00
haptic I think this will be the time... 2015-05-28 01:27:24 -04:00
joystick Another attempt to get this to compile. 2015-05-28 01:08:33 -04:00
libm Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
loadso Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
main Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
power Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
render Fixed bug 2367 - Bad mouse motion coordinates with two windows where one has changed logical size 2015-05-28 12:18:05 -07:00
stdlib Make sure we have the vsscanf() prototype (thanks, Ozkan!). 2015-05-28 14:34:38 -04:00
test Some setups need _GNU_SOURCE to make LLONG_MAX available (thanks, Ozkan!). 2015-05-26 16:31:11 -04:00
thread Uh, yeah, it helps to press "Save" before committing... 2015-05-26 21:30:41 -04:00
timer Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
video Fixed bug 2772 - SDL2 doesn't handle X KeymapNotify events 2015-05-28 10:44:46 -07:00
SDL.c Stack hint should look for 0, not -1, and not care about environment variables. 2015-05-26 21:19:23 -04:00
SDL_assert.c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_assert_c.h Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_error.c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_error_c.h Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_hints.c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_internal.h Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
SDL_log.c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00