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

Windows: Fixed drag and drop position for DPI-unaware windows

This commit is contained in:
ed 2020-07-06 16:50:00 +01:00
parent 3411ea56f5
commit f1a5f2ef1e

View file

@ -1780,16 +1780,16 @@ public:
private:
Point<float> getMousePos (POINTL mousePos) const
{
Point<float> 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<float> (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI);
#endif
screenPos = pointFromPOINT ({ mousePos.x, mousePos.y }).toFloat() / static_cast<float> (getGlobalDPI() / USER_DEFAULT_SCREEN_DPI);
return peer.getComponent().getLocalPoint (nullptr, screenPos);
}