Run in native resolution on Retina displays when streaming above scaled resolution
This commit is contained in:
parent
475a39cb73
commit
6a2b717ff1
1 changed files with 44 additions and 29 deletions
|
|
@ -620,8 +620,24 @@ void Session::updateOptimalWindowDisplayMode()
|
||||||
SDL_DisplayMode desktopMode, bestMode, mode;
|
SDL_DisplayMode desktopMode, bestMode, mode;
|
||||||
int displayIndex = SDL_GetWindowDisplayIndex(m_Window);
|
int displayIndex = SDL_GetWindowDisplayIndex(m_Window);
|
||||||
|
|
||||||
// Get the native desktop resolution
|
// Try the current display mode first. On macOS, this will be the normal
|
||||||
if (StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
// scaled desktop resolution setting.
|
||||||
|
if (SDL_GetDesktopDisplayMode(displayIndex, &desktopMode) == 0) {
|
||||||
|
// If this doesn't fit the selected resolution, use the native
|
||||||
|
// resolution of the panel (unscaled).
|
||||||
|
if (desktopMode.w < m_ActiveVideoWidth || desktopMode.h < m_ActiveVideoHeight) {
|
||||||
|
if (!StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"SDL_GetDesktopDisplayMode() failed: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Start with the native desktop resolution and try to find
|
// Start with the native desktop resolution and try to find
|
||||||
// the highest refresh rate that our stream FPS evenly divides.
|
// the highest refresh rate that our stream FPS evenly divides.
|
||||||
bestMode = desktopMode;
|
bestMode = desktopMode;
|
||||||
|
|
@ -653,7 +669,6 @@ void Session::updateOptimalWindowDisplayMode()
|
||||||
|
|
||||||
SDL_SetWindowDisplayMode(m_Window, &bestMode);
|
SDL_SetWindowDisplayMode(m_Window, &bestMode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Session::toggleFullscreen()
|
void Session::toggleFullscreen()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue