Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some issues with the resolution list (fixes #1772)
Awhile back I added some code to remove any resolutions from the list that exceeded the current DPI. I seem to have misunderstood some of the functionality. First, off, GetCurrentDisplayMode doesn't seem to return current resolution. From my tests, it seems to return a "maximum maximized size" of some sort equal to GetUsableDisplayBounds - 1 (see below): * Render output size: 800, 600 * Display mode size: 1536, 864 * Window size: 800, 600 * Display Bounds: x: 0, y: 0, w: 1537, h: 865 * Usable display bounds: x: 0, y: 0, w: 1537, h: 865 The actual window size, which @CelticMinstrel informs me is what we should be measuring here, is actually returned by either GetWindowSize or GetRenderOutputSize. According to SDL, the latter should return pixel size and the former screen coordinates. In my tests, though, the results are the same. This might be different on macOS or iOS. Either way, I've changed current_resolution(), getx(), and gety() to use the results of GetWindowSize(). Additionally, it seems I don't need to multiply any display modes by the DPI scale factor if I check the sizes against the aforementioned "max maximized area" w/h. For that I use GetDisplayBounds however... though again, I'm not sure that's the best way to do this. It does seem to work correctly to fix the aforementioned bug, anyway. I'll need to figure out more about the handling of DPI on Windows vs macOS or iOS. There's an implication that the measurements some of these functions return is different.
- Loading branch information