diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 2b60c84713..aa6c1753ac 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1780,16 +1780,16 @@ public: private: Point getMousePos (POINTL mousePos) const { - Point screenPos; + auto screenPos = pointFromPOINT ({ mousePos.x, mousePos.y }).toFloat(); #if JUCE_WIN_PER_MONITOR_DPI_AWARE auto h = (HWND) peer.getNativeHandle(); if (isPerMonitorDPIAwareWindow (h)) - screenPos = convertPhysicalScreenPointToLogical (pointFromPOINT ({ mousePos.x, mousePos.y }), h).toFloat(); - else + screenPos = convertPhysicalScreenPointToLogical (screenPos.roundToInt(), h).toFloat(); + #else + screenPos /= static_cast (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI); #endif - screenPos = pointFromPOINT ({ mousePos.x, mousePos.y }).toFloat() / static_cast (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI); return peer.getComponent().getLocalPoint (nullptr, screenPos); }