Harden editor app windowing boundary

This commit is contained in:
2026-04-26 16:01:07 +08:00
parent f4afaf184e
commit ac626d48c4
31 changed files with 473 additions and 553 deletions

View File

@@ -139,6 +139,53 @@ UIEditorWorkspaceController::UIEditorWorkspaceController(
, m_session(std::move(session)) {
}
UIEditorWorkspaceController::UIEditorWorkspaceController(
const UIEditorWorkspaceController& other)
: m_panelRegistry(other.m_panelRegistry)
, m_baselineWorkspace(other.m_baselineWorkspace)
, m_baselineSession(other.m_baselineSession)
, m_workspace(other.m_workspace)
, m_session(other.m_session) {
}
UIEditorWorkspaceController& UIEditorWorkspaceController::operator=(
const UIEditorWorkspaceController& other) {
if (this == &other) {
return *this;
}
m_panelRegistry = other.m_panelRegistry;
m_baselineWorkspace = other.m_baselineWorkspace;
m_baselineSession = other.m_baselineSession;
m_workspace = other.m_workspace;
m_session = other.m_session;
m_boundWorkspace = nullptr;
m_boundSession = nullptr;
return *this;
}
UIEditorWorkspaceController UIEditorWorkspaceController::BindToState(
UIEditorPanelRegistry panelRegistry,
UIEditorWorkspaceModel& workspace,
UIEditorWorkspaceSession& session) {
UIEditorWorkspaceController controller(
std::move(panelRegistry),
workspace,
session);
controller.m_boundWorkspace = &workspace;
controller.m_boundSession = &session;
return controller;
}
void UIEditorWorkspaceController::SyncBoundState() {
if (m_boundWorkspace != nullptr) {
*m_boundWorkspace = m_workspace;
}
if (m_boundSession != nullptr) {
*m_boundSession = m_session;
}
}
UIEditorWorkspaceControllerValidationResult UIEditorWorkspaceController::ValidateState() const {
const UIEditorPanelRegistryValidationResult registryValidation =
ValidateUIEditorPanelRegistry(m_panelRegistry);
@@ -223,6 +270,8 @@ UIEditorWorkspaceCommandResult UIEditorWorkspaceController::FinalizeMutation(
"Command produced invalid workspace state: " + validation.message);
}
SyncBoundState();
return BuildResult(
command,
UIEditorWorkspaceCommandStatus::Changed,
@@ -533,6 +582,8 @@ UIEditorWorkspaceLayoutOperationResult UIEditorWorkspaceController::RestoreLayou
"Restored layout produced invalid controller state: " + validation.message);
}
SyncBoundState();
return BuildLayoutOperationResult(
UIEditorWorkspaceLayoutOperationStatus::Changed,
"Layout restored.");
@@ -595,6 +646,8 @@ UIEditorWorkspaceLayoutOperationResult UIEditorWorkspaceController::SetSplitRati
"Split ratio update produced invalid controller state: " + postValidation.message);
}
SyncBoundState();
return BuildLayoutOperationResult(
UIEditorWorkspaceLayoutOperationStatus::Changed,
"Split ratio updated.");
@@ -701,6 +754,8 @@ UIEditorWorkspaceLayoutOperationResult UIEditorWorkspaceController::MoveTabToSta
"MoveTabToStack produced invalid controller state: " + postValidation.message);
}
SyncBoundState();
return BuildLayoutOperationResult(
UIEditorWorkspaceLayoutOperationStatus::Changed,
"Tab moved to target stack.");
@@ -796,6 +851,8 @@ UIEditorWorkspaceLayoutOperationResult UIEditorWorkspaceController::DockTabRelat
"DockTabRelative produced invalid controller state: " + postValidation.message);
}
SyncBoundState();
return BuildLayoutOperationResult(
UIEditorWorkspaceLayoutOperationStatus::Changed,
"Tab docked relative to target stack.");