Unconditionally calling SDL_ConvertEventToRenderCoordinates() doesn't exactly match SDL2's behavior here because it will still adjust for DPI even if the renderer's logical presentation size is not set. I'm assuming SDL_ConvertEventToRenderCoordinates() is working as intended, so we have to check if logical scaling is enabled before using it.
SDL2 only scales mouse coordinates to the renderer's (logical) size if
SDL_RenderSetLogicalSize()
was called to enable logical scaling. If not, it will send unmodified coordinates in mouse events. Relevant SDL2 code: https://github.com/libsdl-org/SDL/blob/f1690e265e306818882c7c876a9e85492eeefa42/src/render/SDL_render.c#L761-L787Unconditionally calling
SDL_ConvertEventToRenderCoordinates()
doesn't exactly match SDL2's behavior here because it will still adjust for DPI even if the renderer's logical presentation size is not set. I'm assumingSDL_ConvertEventToRenderCoordinates()
is working as intended, so we have to check if logical scaling is enabled before using it.