Refactor editor window synchronization flow

This commit is contained in:
2026-04-26 00:19:58 +08:00
parent 12b71a319f
commit 5b6c46d382
32 changed files with 1787 additions and 320 deletions

View File

@@ -1,6 +1,7 @@
#include "Windowing/Content/EditorWorkspaceWindowContentController.h"
#include <XCEditor/Workspace/UIEditorDetachedWindowPolicy.h>
#include <XCEditor/Workspace/UIEditorWorkspaceLayoutPersistence.h>
namespace XCEngine::UI::Editor::App {
@@ -108,7 +109,10 @@ void EditorWorkspaceWindowContentController::SetViewportSurfacePresentationEnabl
EditorWindowFrameTransferRequests EditorWorkspaceWindowContentController::UpdateAndAppend(
const EditorWindowContentFrameContext& context,
::XCEngine::UI::UIDrawData& drawData) {
return m_frameOrchestrator.UpdateAndAppend(
const auto beforeSnapshot = BuildUIEditorWorkspaceLayoutSnapshot(
m_workspaceController.GetWorkspace(),
m_workspaceController.GetSession());
EditorWindowFrameTransferRequests transferRequests = m_frameOrchestrator.UpdateAndAppend(
context.editorContext,
m_workspaceController,
m_shellRuntime,
@@ -120,6 +124,19 @@ EditorWindowFrameTransferRequests EditorWorkspaceWindowContentController::Update
context.globalTabDragActive,
context.useDetachedTitleBarTabStrip,
drawData);
const auto afterSnapshot = BuildUIEditorWorkspaceLayoutSnapshot(
m_workspaceController.GetWorkspace(),
m_workspaceController.GetSession());
if (!AreUIEditorWorkspaceLayoutSnapshotsEquivalent(beforeSnapshot, afterSnapshot)) {
transferRequests.workspace.workspaceMutation = EditorWindowWorkspaceMutationRequest{
.windowState =
UIEditorWindowWorkspaceState{
.workspace = m_workspaceController.GetWorkspace(),
.session = m_workspaceController.GetSession(),
},
};
}
return transferRequests;
}
void EditorWorkspaceWindowContentController::RenderRequestedViewports(