mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Win32: Fix bad content scale on monitor disconnect
The monitor handle could have become invalid just before the call to GetDpiForMonitor. It was possible for both window and monitor content scale queries. This ensures both that an appropriate error is emitted and that the retrieved values are zero on error. Fixes #1615
This commit is contained in:
parent
d1efa32983
commit
fbfd7e65c8
@ -62,6 +62,7 @@ video tutorials.
|
|||||||
- Mário Freitas
|
- Mário Freitas
|
||||||
- GeO4d
|
- GeO4d
|
||||||
- Marcus Geelnard
|
- Marcus Geelnard
|
||||||
|
- ghuser404
|
||||||
- Charles Giessen
|
- Charles Giessen
|
||||||
- Ryan C. Gordon
|
- Ryan C. Gordon
|
||||||
- Stephen Gowen
|
- Stephen Gowen
|
||||||
|
@ -202,6 +202,9 @@ information on what to include when reporting a bug.
|
|||||||
later (#1783,#1796)
|
later (#1783,#1796)
|
||||||
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
|
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
|
||||||
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
|
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
|
||||||
|
- [Win32] Bugfix: Content scale queries could fail silently (#1615)
|
||||||
|
- [Win32] Bugfix: Content scales could have garbage values if monitor was recently
|
||||||
|
disconnected (#1615)
|
||||||
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||||
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||||
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||||
|
@ -317,8 +317,19 @@ void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* ys
|
|||||||
{
|
{
|
||||||
UINT xdpi, ydpi;
|
UINT xdpi, ydpi;
|
||||||
|
|
||||||
|
if (xscale)
|
||||||
|
*xscale = 0.f;
|
||||||
|
if (yscale)
|
||||||
|
*yscale = 0.f;
|
||||||
|
|
||||||
if (IsWindows8Point1OrGreater())
|
if (IsWindows8Point1OrGreater())
|
||||||
GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);
|
{
|
||||||
|
if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const HDC dc = GetDC(NULL);
|
const HDC dc = GetDC(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user