1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00

Win32: Rename Windows 10 macros for clarity

This switches the Windows 10 version helper macros to include the
version numbers listed in MSDN requirements sections.
This commit is contained in:
Camilla Löwy 2022-03-09 17:30:06 +01:00 committed by Camilla Löwy
parent 8ff9ed92b4
commit 34573798f4
3 changed files with 20 additions and 18 deletions

View File

@ -463,7 +463,7 @@ void _glfwUpdateKeyNamesWin32(void)
UINT flags = 0; UINT flags = 0;
// Avoid modifying the global key state if supported // Avoid modifying the global key state if supported
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
flags = (1 << 2); flags = (1 << 2);
memset(_glfw.win32.keynames, 0, sizeof(_glfw.win32.keynames)); memset(_glfw.win32.keynames, 0, sizeof(_glfw.win32.keynames));
@ -633,7 +633,7 @@ int _glfwInitWin32(void)
createKeyTables(); createKeyTables();
_glfwUpdateKeyNamesWin32(); _glfwUpdateKeyNamesWin32();
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1703OrGreaterWin32())
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
else if (IsWindows8Point1OrGreater()) else if (IsWindows8Point1OrGreater())
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);

View File

@ -176,9 +176,11 @@ typedef enum
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \
LOBYTE(_WIN32_WINNT_WINBLUE), 0) LOBYTE(_WIN32_WINNT_WINBLUE), 0)
#define _glfwIsWindows10AnniversaryUpdateOrGreaterWin32() \ // Windows 10 Anniversary Update
#define _glfwIsWindows10Version1607OrGreaterWin32() \
_glfwIsWindows10BuildOrGreaterWin32(14393) _glfwIsWindows10BuildOrGreaterWin32(14393)
#define _glfwIsWindows10CreatorsUpdateOrGreaterWin32() \ // Windows 10 Creators Update
#define _glfwIsWindows10Version1703OrGreaterWin32() \
_glfwIsWindows10BuildOrGreaterWin32(15063) _glfwIsWindows10BuildOrGreaterWin32(15063)
// HACK: Define macros that some xinput.h variants don't // HACK: Define macros that some xinput.h variants don't

View File

@ -194,7 +194,7 @@ static void getFullWindowSize(DWORD style, DWORD exStyle,
{ {
RECT rect = { 0, 0, contentWidth, contentHeight }; RECT rect = { 0, 0, contentWidth, contentHeight };
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi); AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
else else
AdjustWindowRectEx(&rect, style, FALSE, exStyle); AdjustWindowRectEx(&rect, style, FALSE, exStyle);
@ -211,7 +211,7 @@ static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
UINT dpi = USER_DEFAULT_SCREEN_DPI; UINT dpi = USER_DEFAULT_SCREEN_DPI;
const float ratio = (float) window->numer / (float) window->denom; const float ratio = (float) window->numer / (float) window->denom;
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
dpi = GetDpiForWindow(window->win32.handle); dpi = GetDpiForWindow(window->win32.handle);
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
@ -354,7 +354,7 @@ static void updateWindowStyles(const _GLFWwindow* window)
GetClientRect(window->win32.handle, &rect); GetClientRect(window->win32.handle, &rect);
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, style, FALSE, AdjustWindowRectExForDpi(&rect, style, FALSE,
getWindowExStyle(window), getWindowExStyle(window),
@ -513,7 +513,7 @@ static void maximizeWindowManually(_GLFWwindow* window)
{ {
const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
const UINT dpi = GetDpiForWindow(window->win32.handle); const UINT dpi = GetDpiForWindow(window->win32.handle);
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi); AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
@ -552,7 +552,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
{ {
case WM_NCCREATE: case WM_NCCREATE:
{ {
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
const _GLFWwndconfig* wndconfig = cs->lpCreateParams; const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
@ -1098,7 +1098,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->monitor) if (window->monitor)
break; break;
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
dpi = GetDpiForWindow(window->win32.handle); dpi = GetDpiForWindow(window->win32.handle);
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
@ -1173,7 +1173,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
break; break;
// Adjust the window size to keep the content area size constant // Adjust the window size to keep the content area size constant
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1703OrGreaterWin32())
{ {
RECT source = {0}, target = {0}; RECT source = {0}, target = {0};
SIZE* size = (SIZE*) lParam; SIZE* size = (SIZE*) lParam;
@ -1204,7 +1204,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
// need it to compensate for non-client area scaling // need it to compensate for non-client area scaling
if (!window->monitor && if (!window->monitor &&
(window->win32.scaleToMonitor || (window->win32.scaleToMonitor ||
_glfwIsWindows10CreatorsUpdateOrGreaterWin32())) _glfwIsWindows10Version1703OrGreaterWin32()))
{ {
RECT* suggested = (RECT*) lParam; RECT* suggested = (RECT*) lParam;
SetWindowPos(window->win32.handle, HWND_TOP, SetWindowPos(window->win32.handle, HWND_TOP,
@ -1369,7 +1369,7 @@ static int createNativeWindow(_GLFWwindow* window,
} }
} }
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle,
GetDpiForWindow(window->win32.handle)); GetDpiForWindow(window->win32.handle));
@ -1592,7 +1592,7 @@ void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos)
{ {
RECT rect = { xpos, ypos, xpos, ypos }; RECT rect = { xpos, ypos, xpos, ypos };
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, getWindowStyle(window), AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window), FALSE, getWindowExStyle(window),
@ -1633,7 +1633,7 @@ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
{ {
RECT rect = { 0, 0, width, height }; RECT rect = { 0, 0, width, height };
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, getWindowStyle(window), AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window), FALSE, getWindowExStyle(window),
@ -1700,7 +1700,7 @@ void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window,
_glfwGetWindowSizeWin32(window, &width, &height); _glfwGetWindowSizeWin32(window, &width, &height);
SetRect(&rect, 0, 0, width, height); SetRect(&rect, 0, 0, width, height);
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, getWindowStyle(window), AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window), FALSE, getWindowExStyle(window),
@ -1789,7 +1789,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
{ {
RECT rect = { xpos, ypos, xpos + width, ypos + height }; RECT rect = { xpos, ypos, xpos + width, ypos + height };
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, getWindowStyle(window), AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window), FALSE, getWindowExStyle(window),
@ -1860,7 +1860,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
else else
after = HWND_NOTOPMOST; after = HWND_NOTOPMOST;
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
AdjustWindowRectExForDpi(&rect, getWindowStyle(window), AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window), FALSE, getWindowExStyle(window),