diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 87ec415962..8142dbd28f 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1732,10 +1732,13 @@ public: Point screenPos; #if JUCE_WIN_PER_MONITOR_DPI_AWARE - screenPos = convertPhysicalScreenPointToLogical (pointFromPOINT ({ mousePos.x, mousePos.y }), (HWND) peer.getNativeHandle()).toFloat(); - #else - screenPos = pointFromPOINT ({ mousePos.x, mousePos.y }).toFloat() / static_cast (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI); + auto h = (HWND) peer.getNativeHandle(); + + if (isPerMonitorDPIAwareWindow (h)) + screenPos = convertPhysicalScreenPointToLogical (pointFromPOINT ({ mousePos.x, mousePos.y }), h).toFloat(); + else #endif + screenPos = pointFromPOINT ({ mousePos.x, mousePos.y }).toFloat() / static_cast (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI); return peer.getComponent().getLocalPoint (nullptr, screenPos); }