Fix GetMonitorPhysical* dpi (#3442)

This commit is contained in:
ubkp 2023-10-19 08:09:27 -03:00 committed by GitHub
parent f09840dcdc
commit a64d606cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -230,7 +230,7 @@ void ToggleFullscreen(void)
else else
{ {
SDL_SetWindowFullscreen(platform.window, 0); SDL_SetWindowFullscreen(platform.window, 0);
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
} }
} }
@ -725,12 +725,12 @@ int GetMonitorPhysicalWidth(int monitor)
if ((monitor >= 0) && (monitor < monitorCount)) if ((monitor >= 0) && (monitor < monitorCount))
{ {
float vdpi = 0.0f; float ddpi = 0.0f;
SDL_GetDisplayDPI(monitor, NULL, NULL, &vdpi); SDL_GetDisplayDPI(monitor, &ddpi, NULL, NULL);
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(monitor, &mode); SDL_GetCurrentDisplayMode(monitor, &mode);
// Calculate size on inches, then convert to millimeter // Calculate size on inches, then convert to millimeter
if (vdpi > 0.0f) width = (mode.w/vdpi)*25.4f; if (ddpi > 0.0f) width = (mode.w/ddpi)*25.4f;
} }
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor"); else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
@ -747,12 +747,12 @@ int GetMonitorPhysicalHeight(int monitor)
if ((monitor >= 0) && (monitor < monitorCount)) if ((monitor >= 0) && (monitor < monitorCount))
{ {
float vdpi = 0.0f; float ddpi = 0.0f;
SDL_GetDisplayDPI(monitor, NULL, NULL, &vdpi); SDL_GetDisplayDPI(monitor, &ddpi, NULL, NULL);
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(monitor, &mode); SDL_GetCurrentDisplayMode(monitor, &mode);
// Calculate size on inches, then convert to millimeter // Calculate size on inches, then convert to millimeter
if (vdpi > 0.0f) height = (mode.h/vdpi)*25.4f; if (ddpi > 0.0f) height = (mode.h/ddpi)*25.4f;
} }
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor"); else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");