From 0969b946f65f1891dd3aa8b1cd24af991f50894f Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 3 May 2019 11:04:27 +0100 Subject: [PATCH] Windows: Fixed a build error when JUCE_WIN_PER_MONITOR_DPI_AWARE = 0 --- .../native/juce_win32_Windowing.cpp | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 14c6fa186e..f9d819765b 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -411,25 +411,27 @@ static void setDPIAwareness() setProcessDPIAware(); } -#if JUCE_WIN_PER_MONITOR_DPI_AWARE - static bool isPerMonitorDPIAwareProcess() - { - static bool dpiAware = []() -> bool - { - setDPIAwareness(); +static bool isPerMonitorDPIAwareProcess() +{ + #if JUCE_WIN_PER_MONITOR_DPI_AWARE + static bool dpiAware = []() -> bool + { + setDPIAwareness(); - if (getProcessDPIAwareness == nullptr) - return false; + if (getProcessDPIAwareness == nullptr) + return false; - DPI_Awareness context; - getProcessDPIAwareness (0, &context); + DPI_Awareness context; + getProcessDPIAwareness (0, &context); - return context == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; - }(); + return context == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; + }(); - return dpiAware; - } -#endif + return dpiAware; + #else + return false; + #endif +} static bool isPerMonitorDPIAwareWindow (HWND h) { @@ -448,17 +450,19 @@ static bool isPerMonitorDPIAwareWindow (HWND h) #endif } -#if JUCE_WIN_PER_MONITOR_DPI_AWARE - static bool isPerMonitorDPIAwareThread() - { - setDPIAwareness(); +static bool isPerMonitorDPIAwareThread() +{ + #if JUCE_WIN_PER_MONITOR_DPI_AWARE + setDPIAwareness(); - if (getThreadDPIAwarenessContext != nullptr && getAwarenessFromDPIAwarenessContext != nullptr) - return getAwarenessFromDPIAwarenessContext (getThreadDPIAwarenessContext()) == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; + if (getThreadDPIAwarenessContext != nullptr && getAwarenessFromDPIAwarenessContext != nullptr) + return getAwarenessFromDPIAwarenessContext (getThreadDPIAwarenessContext()) == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; - return isPerMonitorDPIAwareProcess(); - } -#endif + return isPerMonitorDPIAwareProcess(); + #else + return false; + #endif +} static double getGlobalDPI() {