From 8b45ff83e2efe0929fbe14f9ab909ab308a9ea0c Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 16 Sep 2021 11:21:12 +0100 Subject: [PATCH] Windowing: Ignore suggested window sizes for windows that should not be DPI aware --- modules/juce_gui_basics/native/juce_win32_Windowing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 8be4b61818..70276270b3 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -3370,6 +3370,12 @@ private: LRESULT handleDPIChanging (int newDPI, RECT newRect) { + // Sometimes, windows that should not be automatically scaled (secondary windows in plugins) + // are sent WM_DPICHANGED. The size suggested by the OS is incorrect for our unscaled + // window, so we should ignore it. + if (! isPerMonitorDPIAwareWindow (hwnd)) + return 0; + const auto newScale = (double) newDPI / USER_DEFAULT_SCREEN_DPI; if (approximatelyEqual (scaleFactor, newScale))