diff --git a/new_editor/app/Platform/Win32/EditorWindowInput.cpp b/new_editor/app/Platform/Win32/EditorWindowInput.cpp index 6de16440..a4d6852a 100644 --- a/new_editor/app/Platform/Win32/EditorWindowInput.cpp +++ b/new_editor/app/Platform/Win32/EditorWindowInput.cpp @@ -12,6 +12,29 @@ using ::XCEngine::UI::UIInputEvent; using ::XCEngine::UI::UIInputEventType; using ::XCEngine::UI::UIPointerButton; +namespace { + +bool IsScreenPointOverWindow(HWND hwnd, const POINT& screenPoint) { + if (hwnd == nullptr || !IsWindow(hwnd)) { + return false; + } + + const HWND hitWindow = WindowFromPoint(screenPoint); + if (hitWindow == nullptr || GetAncestor(hitWindow, GA_ROOT) != hwnd) { + return false; + } + + RECT windowRect = {}; + if (!GetWindowRect(hwnd, &windowRect)) { + return false; + } + + return screenPoint.x >= windowRect.left && screenPoint.x < windowRect.right && + screenPoint.y >= windowRect.top && screenPoint.y < windowRect.bottom; +} + +} // namespace + bool EditorWindow::ApplyCurrentCursor() const { if (!HasInteractiveCaptureState() && !IsPointerInsideClientArea()) { return false; @@ -29,7 +52,9 @@ bool EditorWindow::ApplyCurrentCursor() const { bool EditorWindow::HasInteractiveCaptureState() const { return m_composition.shellRuntime.HasInteractiveCapture() || - m_chrome.runtime.IsBorderlessWindowDragRestoreArmed(); + m_chrome.runtime.IsBorderlessWindowDragRestoreArmed() || + m_chrome.runtime.IsBorderlessResizeActive() || + GetCapture() == m_window.hwnd; } void EditorWindow::QueuePointerEvent( @@ -125,6 +150,10 @@ bool EditorWindow::IsPointerInsideClientArea() const { return false; } + if (!IsScreenPointOverWindow(m_window.hwnd, screenPoint)) { + return false; + } + const LPARAM pointParam = MAKELPARAM( static_cast(screenPoint.x), static_cast(screenPoint.y));