Win32: Handle content scale error on creation

Only apply the content scale to the initial size of the window if
content scale retrieval succeeded.

Related to #1615.

(cherry picked from commit 53d86c64d7)
This commit is contained in:
Camilla Löwy 2021-12-01 18:09:56 +01:00
parent e10def6de7
commit a69648e192

View File

@ -1297,9 +1297,13 @@ static int createNativeWindow(_GLFWwindow* window,
{ {
float xscale, yscale; float xscale, yscale;
_glfwPlatformGetWindowContentScale(window, &xscale, &yscale); _glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
if (xscale > 0.f && yscale > 0.f)
{
rect.right = (int) (rect.right * xscale); rect.right = (int) (rect.right * xscale);
rect.bottom = (int) (rect.bottom * yscale); rect.bottom = (int) (rect.bottom * yscale);
} }
}
ClientToScreen(window->win32.handle, (POINT*) &rect.left); ClientToScreen(window->win32.handle, (POINT*) &rect.left);
ClientToScreen(window->win32.handle, (POINT*) &rect.right); ClientToScreen(window->win32.handle, (POINT*) &rect.right);