1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Windowing: Avoid recursively calling WM_NCHITTEST in contains()

This commit is contained in:
reuk 2024-06-12 13:39:44 +01:00
parent adbb0850ed
commit 515e9b9f89

View file

@ -1782,8 +1782,22 @@ public:
if (! r.withZeroOrigin().contains (localPos))
return false;
auto w = WindowFromPoint (D2DUtilities::toPOINT (convertLogicalScreenPointToPhysical (localPos + getScreenPosition(),
hwnd)));
const auto screenPos = convertLogicalScreenPointToPhysical (localPos + getScreenPosition(), hwnd);
if (trueIfInAChildWindow)
{
// Quick check to see whether the point is inside the client bounds
RECT rect;
GetClientRect (hwnd, &rect);
POINT points[2];
memcpy (points, &rect, sizeof (points));
MapWindowPoints (hwnd, nullptr, points, (UINT) std::size (points));
memcpy (&rect, points, sizeof (points));
return PtInRect (&rect, D2DUtilities::toPOINT (screenPos));
}
auto w = WindowFromPoint (D2DUtilities::toPOINT (screenPos));
return w == hwnd || (trueIfInAChildWindow && (IsChild (hwnd, w) != 0));
}