fix(new_editor/cursor): stabilize multi-window resize cursors
This commit is contained in:
@@ -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<SHORT>(screenPoint.x),
|
||||
static_cast<SHORT>(screenPoint.y));
|
||||
|
||||
Reference in New Issue
Block a user