macOS: Fix issue causing only part of the window to be rendered to (#3756)

The fundamental issue is related to hiDPI / Retina displays, I don't
think our rendering code is setup properly to handle the scaling between
the two (which you can derive by comparing `SDL_GetWindowSize` and
`SDL_GL_GetDrawableSize`).

So rather than opening that can of worms, I just removed the window
flag.

Also fixed an unrelated issue for displaying resolution options when in
windowed mode, it was previously only adding options to the list if they
were invalid for full-screen.

Fixes #3099
This commit is contained in:
Tyler Wilding 2024-11-13 11:16:30 -05:00 committed by GitHub
parent 2a41bc615e
commit 2c6d41c87a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -220,9 +220,10 @@ static std::shared_ptr<GfxDisplay> gl_make_display(int width,
// TODO - SDL2 doesn't seem to support HDR (and neither does windows)
// Related -
// https://answers.microsoft.com/en-us/windows/forum/all/hdr-monitor-low-brightness-after-exiting-full/999f7ee9-7ba3-4f9c-b812-bbeb9ff8dcc1
SDL_Window* window =
SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_Window* window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
// TODO - rendering code on hiDPI/Retina displays is not adequate, solve it properly so that
// `SDL_WINDOW_ALLOW_HIGHDPI` can be added back to the window flags.
prof().end_event();
if (!window) {
sdl_util::log_error("gl_make_display failed - Could not create display window");

View File

@ -404,6 +404,7 @@ void DisplayManager::update_resolutions() {
}
lg::info("[DISPLAY]: {}x{} is supported", new_res.width, new_res.height);
m_available_resolutions.push_back(new_res);
m_available_window_sizes.push_back(new_res);
}
// Sort by area
@ -411,7 +412,7 @@ void DisplayManager::update_resolutions() {
[](const Resolution& a, const Resolution& b) -> bool {
return a.width * a.height > b.width * b.height;
});
std::sort(m_available_resolutions.begin(), m_available_resolutions.end(),
std::sort(m_available_window_sizes.begin(), m_available_window_sizes.end(),
[](const Resolution& a, const Resolution& b) -> bool {
return a.width * a.height > b.width * b.height;
});