new_editor: filter closing windows from interaction
This commit is contained in:
@@ -68,6 +68,12 @@ bool CanStartGlobalTabDragFromWindow(
|
||||
extractedPanel);
|
||||
}
|
||||
|
||||
bool IsLiveInteractiveWindow(const EditorWindow* window) {
|
||||
return window != nullptr &&
|
||||
window->GetHwnd() != nullptr &&
|
||||
!window->IsClosing();
|
||||
}
|
||||
|
||||
std::size_t ResolveDropInsertionIndex(
|
||||
const Widgets::UIEditorDockHostTabStackLayout& tabStack,
|
||||
const UIPoint& point) {
|
||||
@@ -240,7 +246,7 @@ void EditorWindowWorkspaceCoordinator::UpdateGlobalTabDragOwnerWindowPosition()
|
||||
}
|
||||
|
||||
EditorWindow* ownerWindow = m_hostRuntime.FindWindow(m_globalTabDragSession.panelWindowId);
|
||||
if (ownerWindow == nullptr || ownerWindow->GetHwnd() == nullptr) {
|
||||
if (!IsLiveInteractiveWindow(ownerWindow)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -273,7 +279,7 @@ void EditorWindowWorkspaceCoordinator::ClearGlobalTabDragDropPreview() {
|
||||
}
|
||||
|
||||
if (EditorWindow* previewWindow = m_hostRuntime.FindWindow(m_globalTabDragSession.previewWindowId);
|
||||
previewWindow != nullptr) {
|
||||
IsLiveInteractiveWindow(previewWindow)) {
|
||||
previewWindow->ClearExternalDockHostDropPreview();
|
||||
previewWindow->InvalidateHostWindow();
|
||||
}
|
||||
@@ -288,7 +294,7 @@ void EditorWindowWorkspaceCoordinator::UpdateGlobalTabDragDropPreview() {
|
||||
EditorWindow* targetWindow = FindTopmostWindowAtScreenPoint(
|
||||
m_globalTabDragSession.screenPoint,
|
||||
m_globalTabDragSession.panelWindowId);
|
||||
if (targetWindow == nullptr || targetWindow->GetHwnd() == nullptr) {
|
||||
if (!IsLiveInteractiveWindow(targetWindow)) {
|
||||
ClearGlobalTabDragDropPreview();
|
||||
return;
|
||||
}
|
||||
@@ -333,7 +339,9 @@ void EditorWindowWorkspaceCoordinator::EndGlobalTabDragSession() {
|
||||
if (GetCapture() == ownerWindow->GetHwnd()) {
|
||||
ReleaseCapture();
|
||||
}
|
||||
ownerWindow->ResetInteractionState();
|
||||
if (!ownerWindow->IsClosing()) {
|
||||
ownerWindow->ResetInteractionState();
|
||||
}
|
||||
}
|
||||
|
||||
m_globalTabDragSession = {};
|
||||
@@ -345,7 +353,11 @@ bool EditorWindowWorkspaceCoordinator::HandleGlobalTabDragPointerMove(HWND hwnd)
|
||||
}
|
||||
|
||||
const EditorWindow* ownerWindow = m_hostRuntime.FindWindow(m_globalTabDragSession.panelWindowId);
|
||||
if (ownerWindow == nullptr || ownerWindow->GetHwnd() != hwnd) {
|
||||
if (!IsLiveInteractiveWindow(ownerWindow)) {
|
||||
EndGlobalTabDragSession();
|
||||
return false;
|
||||
}
|
||||
if (ownerWindow->GetHwnd() != hwnd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -364,7 +376,11 @@ bool EditorWindowWorkspaceCoordinator::HandleGlobalTabDragPointerButtonUp(HWND h
|
||||
}
|
||||
|
||||
const EditorWindow* ownerWindow = m_hostRuntime.FindWindow(m_globalTabDragSession.panelWindowId);
|
||||
if (ownerWindow == nullptr || ownerWindow->GetHwnd() != hwnd) {
|
||||
if (!IsLiveInteractiveWindow(ownerWindow)) {
|
||||
EndGlobalTabDragSession();
|
||||
return false;
|
||||
}
|
||||
if (ownerWindow->GetHwnd() != hwnd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,7 +393,7 @@ bool EditorWindowWorkspaceCoordinator::HandleGlobalTabDragPointerButtonUp(HWND h
|
||||
EndGlobalTabDragSession();
|
||||
|
||||
EditorWindow* targetWindow = FindTopmostWindowAtScreenPoint(screenPoint, panelWindowId);
|
||||
if (targetWindow == nullptr || targetWindow->GetHwnd() == nullptr) {
|
||||
if (!IsLiveInteractiveWindow(targetWindow)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -423,7 +439,8 @@ bool EditorWindowWorkspaceCoordinator::HandleGlobalTabDragPointerButtonUp(HWND h
|
||||
|
||||
if (EditorWindow* updatedTargetWindow = m_hostRuntime.FindWindow(targetWindow->GetWindowId());
|
||||
updatedTargetWindow != nullptr &&
|
||||
updatedTargetWindow->GetHwnd() != nullptr) {
|
||||
updatedTargetWindow->GetHwnd() != nullptr &&
|
||||
!updatedTargetWindow->IsClosing()) {
|
||||
SetForegroundWindow(updatedTargetWindow->GetHwnd());
|
||||
}
|
||||
LogRuntimeTrace(
|
||||
@@ -436,6 +453,11 @@ bool EditorWindowWorkspaceCoordinator::HandleGlobalTabDragPointerButtonUp(HWND h
|
||||
bool EditorWindowWorkspaceCoordinator::TryStartGlobalTabDrag(
|
||||
EditorWindow& sourceWindow,
|
||||
const EditorWindowPanelTransferRequest& request) {
|
||||
if (sourceWindow.IsClosing()) {
|
||||
LogRuntimeTrace("drag", "failed to start global tab drag: source window is closing");
|
||||
return false;
|
||||
}
|
||||
|
||||
POINT dragHotspot = BuildFallbackGlobalTabDragHotspot();
|
||||
TryResolveGlobalTabDragHotspot(
|
||||
sourceWindow,
|
||||
@@ -468,7 +490,7 @@ bool EditorWindowWorkspaceCoordinator::TryStartGlobalTabDrag(
|
||||
}
|
||||
|
||||
EditorWindow* detachedWindow = m_hostRuntime.FindWindow(result.targetWindowId);
|
||||
if (detachedWindow == nullptr || detachedWindow->GetHwnd() == nullptr) {
|
||||
if (!IsLiveInteractiveWindow(detachedWindow)) {
|
||||
LogRuntimeTrace("drag", "detached drag window was not created.");
|
||||
return false;
|
||||
}
|
||||
@@ -518,6 +540,11 @@ bool EditorWindowWorkspaceCoordinator::TryStartGlobalTabDrag(
|
||||
bool EditorWindowWorkspaceCoordinator::TryProcessDetachRequest(
|
||||
EditorWindow& sourceWindow,
|
||||
const EditorWindowPanelTransferRequest& request) {
|
||||
if (sourceWindow.IsClosing()) {
|
||||
LogRuntimeTrace("detach", "detach request rejected: source window is closing");
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string sourceWindowId(sourceWindow.GetWindowId());
|
||||
UIEditorWindowWorkspaceController windowWorkspaceController =
|
||||
BuildLiveWindowWorkspaceController(sourceWindowId);
|
||||
@@ -541,7 +568,8 @@ bool EditorWindowWorkspaceCoordinator::TryProcessDetachRequest(
|
||||
|
||||
if (EditorWindow* detachedWindow = m_hostRuntime.FindWindow(result.targetWindowId);
|
||||
detachedWindow != nullptr &&
|
||||
detachedWindow->GetHwnd() != nullptr) {
|
||||
detachedWindow->GetHwnd() != nullptr &&
|
||||
!detachedWindow->IsClosing()) {
|
||||
SetForegroundWindow(detachedWindow->GetHwnd());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user