From 82dc6d1c7ea4a46c6961a9c8c8b341d18cdd71a5 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 4 Nov 2025 18:08:38 +0000 Subject: [PATCH] Windows: Fix a bug where windows with non-native titlebars could be maximised to the wrong size This issue presented after the following sequence of steps: - Display a window with a non-native titlebar - Maximise it - Click the taskbar icon to minimise it - Click the taskbar icon again to maximise it After being maximised for the second time, the window bounds were too large for the display. This is because the check in WM_NCCALCSIZE was failing to determine the target monitor for the window, and therefore failing to adjust the new area appropriately. We now determine the target monitor based on the proposed new bounds of the new window, rather than the current bounds of the window, which may not be meaningful if the window is minimised. --- modules/juce_gui_basics/native/juce_Windowing_windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index 02b2fd24cc..870712d587 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -4006,7 +4006,7 @@ private: // so that the client area exactly fills the available space. if (isFullScreen()) { - const auto monitor = MonitorFromWindow (hwnd, MONITOR_DEFAULTTONULL); + const auto monitor = MonitorFromRect (param, MONITOR_DEFAULTTONULL); if (monitor == nullptr) return 0;