From b5a06b0e2fe2dff7cde3e3615cc6781ed6a253d1 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 11 Feb 2021 09:30:48 +0000 Subject: [PATCH] Windows: Use MapWindowPoints() in HWNDComponentPeer::getBounds() to get correct client coordinates when we're the child of another HWND --- modules/juce_gui_basics/native/juce_win32_Windowing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 5edba28683..09bde1ceb0 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1416,8 +1416,8 @@ public: if (auto parentH = GetParent (hwnd)) { - auto r = getWindowRect (parentH); - auto localBounds = rectangleFromRECT (bounds).translated (-r.left, -r.top); + MapWindowPoints (HWND_DESKTOP, parentH, (LPPOINT) &bounds, 2); + auto localBounds = rectangleFromRECT (bounds); #if JUCE_WIN_PER_MONITOR_DPI_AWARE if (isPerMonitorDPIAwareWindow (hwnd))