From 57c739c444f58512b16c50b3c582d28ae2bfabe9 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 18 Sep 2025 16:20:00 +0100 Subject: [PATCH] Windows: Remove isStandaloneApp checks --- .../native/juce_Windowing_windows.cpp | 17 ++--------------- .../juce_opengl/opengl/juce_OpenGLContext.cpp | 4 ---- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index 0321f9f298..ffdb94481d 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -355,9 +355,6 @@ static void setDPIAwareness() hasCheckedForDPIAwareness = true; - if (! JUCEApplicationBase::isStandaloneApp()) - return; - loadDPIAwarenessFunctions(); if (SetProcessDpiAwarenessContext (DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) @@ -381,9 +378,6 @@ static bool isPerMonitorDPIAwareProcess() { setDPIAwareness(); - if (! JUCEApplication::isStandaloneApp()) - return false; - PROCESS_DPI_AWARENESS context{}; GetProcessDpiAwareness (nullptr, &context); @@ -580,8 +574,7 @@ static Point convertLogicalScreenPointToPhysical (Point p, HWND h) noe return p; } -JUCE_API double getScaleFactorForWindow (HWND h); -JUCE_API double getScaleFactorForWindow (HWND h) +static double getScaleFactorForWindow (HWND h) { return (double) GetDpiForWindow (h) / USER_DEFAULT_SCREEN_DPI; } @@ -618,7 +611,7 @@ RTL_OSVERSIONINFOW getWindowsVersionInfo(); double Desktop::getDefaultMasterScale() { - if (! JUCEApplicationBase::isStandaloneApp() || isPerMonitorDPIAwareProcess()) + if (isPerMonitorDPIAwareProcess()) return 1.0; return getGlobalDPI() / USER_DEFAULT_SCREEN_DPI; @@ -3397,12 +3390,6 @@ 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)) diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index a02f90ac00..3cf314ea16 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -80,10 +80,6 @@ private: #endif -#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE - extern JUCE_API double getScaleFactorForWindow (HWND); -#endif - static bool contextHasTextureNpotFeature() { if (getOpenGLVersion() >= Version (2))