From 56230ca17385cbdb1e79557bd950b9a13f29ac09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 19 Jan 2021 22:25:05 +0100 Subject: [PATCH 1/9] Win32: Fix full screen windows affected by scaling Per-monitor DPI scaling should not affect full screen windows. Fixes #1582. (cherry picked from commit 410890aa8058a0c5a33f2e00d750326ba412e466) --- README.md | 2 ++ src/win32_window.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f22bb6f..057c94aa 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,8 @@ information on what to include when reporting a bug. configuration change (#1761) - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) - [Win32] Bugfix: Duplicate size events were not filtered (#1610) + - [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes + (#1582) - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 (#1635) diff --git a/src/win32_window.c b/src/win32_window.c index 15fe2aa9..b5aacca2 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1133,7 +1133,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, // Only apply the suggested size if the OS is new enough to have // sent a WM_GETDPISCALEDSIZE before this - if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) + if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32() && !window->monitor) { RECT* suggested = (RECT*) lParam; SetWindowPos(window->win32.handle, HWND_TOP, From 900dda7e89835c455daaa9b51c6051c1c43a7f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 20 Jan 2021 01:02:24 +0100 Subject: [PATCH 2/9] Win32: Fix content area rescaling on older systems GLFW_SCALE_TO_MONITOR had no effect on Windows 8.1 up to and including Windows 10 version 1607 (Anniversary Update), despite those having support for per-monitor DPI. That done was to avoid handling systems that have non-client scaling, introduced in Windows 10 version 1607, without reliable overriding of the new window size, introduced in Windows 10 version 1703 (Creators Update). Both are needed to keep the content area at a fixed size for windows that have GLFW_SCALE_TO_MONITOR disabled. This change enables window rescaling on Windows 8.1 and all later versions but disables non-client scaling for unscaled windows on Windows 10 version 1607. Versions after 1607 are unaffected. Fixes #1511. (cherry picked from commit 729c9988d02004faac1663c18c7628bae193a95d) --- README.md | 2 ++ src/win32_window.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 057c94aa..6090c36c 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,8 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Duplicate size events were not filtered (#1610) - [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes (#1582) + - [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than + Windows 10 version 1703 (#1511) - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 (#1635) diff --git a/src/win32_window.c b/src/win32_window.c index b5aacca2..d17b6da4 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -505,7 +505,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_NCCREATE: { if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) - EnableNonClientDpiScaling(hWnd); + { + const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; + const _GLFWwndconfig* wndconfig = cs->lpCreateParams; + + // On per-monitor DPI aware V1 systems, only enable + // non-client scaling for windows that scale the client area + // We need WM_GETDPISCALEDSIZE from V2 to keep the client + // area static when the non-client area is scaled + if (wndconfig && wndconfig->scaleToMonitor) + EnableNonClientDpiScaling(hWnd); + } break; } @@ -1131,9 +1141,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; - // Only apply the suggested size if the OS is new enough to have - // sent a WM_GETDPISCALEDSIZE before this - if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32() && !window->monitor) + // Resize windowed mode windows that either permit rescaling or that + // need it to compensate for non-client area scaling + if (!window->monitor && + (window->win32.scaleToMonitor || + _glfwIsWindows10CreatorsUpdateOrGreaterWin32())) { RECT* suggested = (RECT*) lParam; SetWindowPos(window->win32.handle, HWND_TOP, @@ -1248,7 +1260,7 @@ static int createNativeWindow(_GLFWwindow* window, NULL, // No parent window NULL, // No window menu GetModuleHandleW(NULL), - NULL); + (LPVOID) wndconfig); free(wideTitle); From 0c22ebac36d08e47629c92e13c1824cb726ad84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 9 Feb 2021 21:33:23 +0100 Subject: [PATCH 3/9] Wayland: Move DPI fallback work to output done This removes the dependency on the (unspecified) ordering of geometry and mode events in wl_output. Based on feedback from @linkmauve and @caramelli. Related to #1792. (cherry picked from commit b925a54ef11adab250e4e9592afe918c1f8caebb) --- src/wl_monitor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 48b25b9f..a7b05c60 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -88,6 +88,14 @@ static void outputHandleDone(void* data, struct wl_output* output) { struct _GLFWmonitor *monitor = data; + if (monitor->widthMM <= 0 || monitor->heightMM <= 0) + { + // If Wayland does not provide a physical size, assume the default 96 DPI + const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode]; + monitor->widthMM = (int) (mode->width * 25.4f / 96.f); + monitor->heightMM = (int) (mode->height * 25.4f / 96.f); + } + _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); } From 901d30b973c536f26b74bca1134c5892d54b251d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 17 Feb 2021 21:21:49 +0100 Subject: [PATCH 4/9] Update changelog (cherry picked from commit 2c7f3ce91b4f22773855c43d6480824ed4ac9907) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6090c36c..182df18b 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ information on what to include when reporting a bug. (#1463) - [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong worder (#1798) + - [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792) ## Contact From b8202d9ca3cc169e3ccfb597af9bb7a3c8a80afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 23 Feb 2021 21:23:46 +0100 Subject: [PATCH 5/9] Start 3.3.4 --- CMakeLists.txt | 2 +- README.md | 42 +----------------------------------------- include/GLFW/glfw3.h | 2 +- 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4f30293..e2962df9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) -project(GLFW VERSION 3.3.3 LANGUAGES C) +project(GLFW VERSION 3.3.4 LANGUAGES C) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) diff --git a/README.md b/README.md index 182df18b..5538a8a7 100644 --- a/README.md +++ b/README.md @@ -118,47 +118,7 @@ information on what to include when reporting a bug. ## Changelog - - Bugfix: Some extension loader headers did not prevent default OpenGL header - inclusion (#1695) - - [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are - opaque (#1512) - - [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 - - [Win32] Bugfix: Monitor functions could return invalid values after - configuration change (#1761) - - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) - - [Win32] Bugfix: Duplicate size events were not filtered (#1610) - - [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes - (#1582) - - [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than - Windows 10 version 1703 (#1511) - - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 - (#1635) - - [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays - could leak memory - - [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787) - - [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830) - - [Cocoa] Bugfix: Menubar was not clickable on macOS 10.15+ until it lost and - regained focus (#1648,#1802) - - [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833) - - [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504) - - [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636) - - [X11] Bugfix: Xlib errors caused by other parts of the application could be - reported as GLFW errors - - [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633) - - [X11] Bugfix: XKB path used keysyms instead of physical locations for - non-printable keys (#1598) - - [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout - combinaitons (#1598) - - [X11] Bugfix: Keys pressed simultaneously with others were not always - reported (#1112,#1415,#1472,#1616) - - [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704) - - [Wayland] Bugfix: Retrieving partial framebuffer size would segfault - - [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms - (#1463) - - [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong worder - (#1798) - - [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792) +There is nothing here yet. ## Contact diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 35bbf075..c8d7cfaf 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -295,7 +295,7 @@ extern "C" { * API changes. * @ingroup init */ -#define GLFW_VERSION_REVISION 3 +#define GLFW_VERSION_REVISION 4 /*! @} */ /*! @brief One. From 0f46d089e81d010d25c50eb473e868c8127d44b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 8 Mar 2021 19:32:36 +0100 Subject: [PATCH 6/9] X11: Fix attribs not applied on leaving fullscreen If the GLFW_DECORATED and/or GLFW_FLOATING window attributes were changed while in fullscreen mode, the changes did not take effect when the window entered windowed mode. Bug reported on the GLFW forum. https://discourse.glfw.org/t/turning-on-off-window-decorations-while-in-full-screen-wont-work-properly/1780 (cherry picked from commit 4afa227a056681d2628894b0893527bf69496a41) --- README.md | 2 +- src/x11_window.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5538a8a7..1291216c 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ information on what to include when reporting a bug. ## Changelog -There is nothing here yet. + - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index 90c4d9be..d52ebc4d 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2500,7 +2500,11 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, } if (window->monitor) + { + _glfwPlatformSetWindowDecorated(window, window->decorated); + _glfwPlatformSetWindowFloating(window, window->floating); releaseMonitor(window); + } _glfwInputWindowMonitor(window, monitor); updateNormalHints(window, width, height); From b39c02b118f988f56ff355b13ba49a667eb021ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 15 Mar 2021 00:48:05 +0100 Subject: [PATCH 7/9] Win32: Add warning when option will have no effect The GPU driver only looks in the executable for the symbol requesting the high-performance GPU, so enabling them when buidling GLFW as a DLL will have no effect. (cherry picked from commit 52ba8c7f07574d56955099179f35569e07e2001c) --- src/win32_init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/win32_init.c b/src/win32_init.c index a7a6be6a..22c1ba77 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -39,6 +39,10 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID = #if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) +#if defined(_GLFW_BUILD_DLL) + #warning "These symbols must be exported by the executable and have no effect in a DLL" +#endif + // Executables (but not DLLs) exporting this symbol with this value will be // automatically directed to the high-performance GPU on Nvidia Optimus systems // with up-to-date drivers From 814b7929c5add4b0541ccad26fb81f28b71dc4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 19 Mar 2021 14:47:28 +0100 Subject: [PATCH 8/9] Add issue number to changelog Related to #1863. (cherry picked from commit 33cd8b865d9289cfbcf3d95e6e68e4050b94fcd3) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1291216c..76907a1e 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ information on what to include when reporting a bug. ## Changelog - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen + (#1863) ## Contact From 713711f5e93589c7c1e3e70c971577ae1bc5817a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 8 Apr 2021 20:48:17 +0200 Subject: [PATCH 9/9] Start 3.3.5 --- CMakeLists.txt | 2 +- README.md | 3 +-- include/GLFW/glfw3.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2962df9..1a203cce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) -project(GLFW VERSION 3.3.4 LANGUAGES C) +project(GLFW VERSION 3.3.5 LANGUAGES C) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) diff --git a/README.md b/README.md index 76907a1e..5538a8a7 100644 --- a/README.md +++ b/README.md @@ -118,8 +118,7 @@ information on what to include when reporting a bug. ## Changelog - - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen - (#1863) +There is nothing here yet. ## Contact diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index c8d7cfaf..1b059062 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -295,7 +295,7 @@ extern "C" { * API changes. * @ingroup init */ -#define GLFW_VERSION_REVISION 4 +#define GLFW_VERSION_REVISION 5 /*! @} */ /*! @brief One.