mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Win32: Fix invalid calls to GetDpiForWindow
The check for Windows 10 Anniversary Edition or later was not always performed before calling GetDpiForWindow. Fixes #1335. Closes #1363.
This commit is contained in:
parent
1725d1c4f5
commit
e779280802
@ -209,11 +209,14 @@ static void getFullWindowSize(DWORD style, DWORD exStyle,
|
||||
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
|
||||
{
|
||||
int xoff, yoff;
|
||||
UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
||||
const float ratio = (float) window->numer / (float) window->denom;
|
||||
|
||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||
dpi = GetDpiForWindow(window->win32.handle);
|
||||
|
||||
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
|
||||
0, 0, &xoff, &yoff,
|
||||
GetDpiForWindow(window->win32.handle));
|
||||
0, 0, &xoff, &yoff, dpi);
|
||||
|
||||
if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT ||
|
||||
edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT)
|
||||
@ -1001,14 +1004,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
int xoff, yoff;
|
||||
UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
||||
MINMAXINFO* mmi = (MINMAXINFO*) lParam;
|
||||
|
||||
if (window->monitor)
|
||||
break;
|
||||
|
||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||
dpi = GetDpiForWindow(window->win32.handle);
|
||||
|
||||
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
|
||||
0, 0, &xoff, &yoff,
|
||||
GetDpiForWindow(window->win32.handle));
|
||||
0, 0, &xoff, &yoff, dpi);
|
||||
|
||||
if (window->minwidth != GLFW_DONT_CARE &&
|
||||
window->minheight != GLFW_DONT_CARE)
|
||||
|
Loading…
Reference in New Issue
Block a user