From 1237b34c843d8c4103e7ee1ca4ce561cb4893691 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 21 Aug 2025 17:42:37 +0100 Subject: [PATCH] Windowing: Avoid dynamically loading GetSystemMetricsForDpi, which is always present on Windows 10 --- .../native/juce_Windowing_windows.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index afe65b6116..4b7e90146d 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -6063,20 +6063,6 @@ private: static auto getCursorSizeForPeerFunction() -> int (*) (ComponentPeer&) { - static const auto getSystemMetricsForDpi = []() -> GetSystemMetricsForDpiFunc - { - constexpr auto library = "User32.dll"; - LoadLibraryA (library); - - if (auto* handle = GetModuleHandleA (library)) - return (GetSystemMetricsForDpiFunc) GetProcAddress (handle, "GetSystemMetricsForDpi"); - - return nullptr; - }(); - - if (getSystemMetricsForDpi == nullptr) - return [] (ComponentPeer&) { return unityCursorSize; }; - return [] (ComponentPeer& p) { const ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { p.getNativeHandle() }; @@ -6085,7 +6071,7 @@ private: if (auto* monitor = MonitorFromWindow ((HWND) p.getNativeHandle(), MONITOR_DEFAULTTONULL)) if (SUCCEEDED (GetDpiForMonitor (monitor, MDT_DEFAULT, &dpiX, &dpiY))) - return getSystemMetricsForDpi (SM_CXCURSOR, dpiX); + return GetSystemMetricsForDpi (SM_CXCURSOR, dpiX); return unityCursorSize; };