| Summary: | [patch] macOS fix SDL_GetCurrentDisplayMode returning points in a scaled retina resolution | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Eric Wasylishen <ewasylishen> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | HG 2.1 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
| Attachments: | patch for SDL_GetCurrentDisplayMode | ||
|
Description
Eric Wasylishen
2017-07-12 19:05:30 UTC
(In reply to Eric Wasylishen from comment #0) > When the system has a scaled retina mode active, (e.g. system preferences -> > display -> resolution (scaled) -> Larger Text), SDL_GetCurrentDisplayMode > was returning width/height in points, not pixels. > Afaik, we want it to always return pixels (I also updated the comments in > the SDL_DisplayMode struct to clarify that the units are pixels). SDL display modes are intentionally in points rather than pixels. It would be handy to have additional fields in the struct for pixel dimensions, though SDL window positions and dimensions are also in points rather than pixels (SDL_GL_GetDrawableSize and SDL_GetRendererOutputSize are the only two functions that explicitly return pixel dimensions, in SDL). So the coordinate space of display modes should match that of window sizes, right now. Ah, I see. The reason I was thinking the width/height of the SDL_DisplayMode struct had to be pixels, is the fact that the window is stretched to fill the screen means the points part of the high-DPI equation cancels out. i.e. normally you have: window_pixels = window_points * (screen_pixels / screen_points) but if "window_points" is defined to be equal to "screen_points", as is the case in fullscreen, then you just have "window_pixels = screen_pixels". The only part where this argument breaks is mouse cursor size (or if somehow other windows were dragged on top of a SDL fullscreen window). I committed a different change to fix the BZFlag issue: https://hg.libsdl.org/SDL/rev/1e26564c7288 |