1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windowing: Avoid dynamically loading GetSystemMetricsForDpi, which is always present on Windows 10

This commit is contained in:
reuk 2025-08-21 17:42:37 +01:00
parent 5048d359e5
commit 1237b34c84
No known key found for this signature in database

View file

@ -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;
};