Refactor editor windowing boundaries
This commit is contained in:
@@ -7,14 +7,10 @@
|
||||
#include "Platform/Win32/Windowing/EditorWindow.h"
|
||||
#include "Windowing/Content/EditorWindowContentFactory.h"
|
||||
#include "Windowing/Content/EditorWindowContentController.h"
|
||||
#include "Windowing/Host/EditorWindowHostCoordinator.h"
|
||||
#include "Platform/Win32/Runtime/EditorWindowFrameDriver.h"
|
||||
#include "Windowing/Coordinator/EditorUtilityWindowCoordinator.h"
|
||||
#include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h"
|
||||
#include "Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h"
|
||||
|
||||
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Foundation/UIEditorRuntimeTrace.h>
|
||||
#include <XCEditor/Windowing/EditorWindowSystem.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
@@ -62,12 +58,10 @@ EditorWindowHostRuntime::EditorWindowHostRuntime(
|
||||
EditorWindowHostConfig hostConfig,
|
||||
std::filesystem::path repoRoot,
|
||||
EditorContext& editorContext,
|
||||
EditorWindowSystem& windowSystem,
|
||||
EditorWindowContentFactory& contentFactory)
|
||||
: m_hostConfig(hostConfig),
|
||||
m_repoRoot(std::move(repoRoot)),
|
||||
m_editorContext(editorContext),
|
||||
m_windowSystem(windowSystem),
|
||||
m_contentFactory(contentFactory) {}
|
||||
|
||||
EditorWindowHostRuntime::~EditorWindowHostRuntime() = default;
|
||||
@@ -152,7 +146,11 @@ EditorWindow* EditorWindowHostRuntime::CreateEditorWindow(
|
||||
|
||||
auto failWindowInitialization = [&](std::string_view message) {
|
||||
LogRuntimeTrace("window", std::string(message));
|
||||
m_lifecycleCoordinator->AbortUnregisteredWindow(*rawWindow);
|
||||
if (m_hostCoordinator != nullptr) {
|
||||
m_hostCoordinator->AbortUnregisteredWindow(*rawWindow);
|
||||
} else {
|
||||
eraseRawWindow();
|
||||
}
|
||||
return static_cast<EditorWindow*>(nullptr);
|
||||
};
|
||||
|
||||
@@ -193,13 +191,23 @@ EditorWindow* EditorWindowHostRuntime::CreateEditorWindow(
|
||||
}
|
||||
|
||||
EditorWindow* EditorWindowHostRuntime::CreateWorkspaceWindow(
|
||||
UIEditorWorkspaceController workspaceController,
|
||||
const UIEditorWindowWorkspaceState& windowState,
|
||||
const EditorWindowCreateParams& params) {
|
||||
if (windowState.windowId.empty()) {
|
||||
LogRuntimeTrace("window", "workspace window creation rejected: state missing window id");
|
||||
return nullptr;
|
||||
}
|
||||
if (!params.windowId.empty() && windowState.windowId != params.windowId) {
|
||||
LogRuntimeTrace(
|
||||
"window",
|
||||
"workspace window creation rejected: state window id '" +
|
||||
windowState.windowId + "' does not match create params '" +
|
||||
params.windowId + "'");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return CreateEditorWindow(
|
||||
m_contentFactory.CreateWorkspaceContentController(
|
||||
params.windowId,
|
||||
std::move(workspaceController),
|
||||
m_windowSystem),
|
||||
m_contentFactory.CreateWorkspaceContentController(windowState),
|
||||
params);
|
||||
}
|
||||
|
||||
@@ -211,9 +219,9 @@ EditorWindow* EditorWindowHostRuntime::CreateUtilityWindow(
|
||||
params);
|
||||
}
|
||||
|
||||
void EditorWindowHostRuntime::BindLifecycleCoordinator(
|
||||
EditorWindowLifecycleCoordinator& lifecycleCoordinator) {
|
||||
m_lifecycleCoordinator = &lifecycleCoordinator;
|
||||
void EditorWindowHostRuntime::BindHostCoordinator(
|
||||
EditorWindowHostCoordinator& hostCoordinator) {
|
||||
m_hostCoordinator = &hostCoordinator;
|
||||
}
|
||||
|
||||
void EditorWindowHostRuntime::HandlePendingNativeWindowCreated(HWND hwnd) {
|
||||
@@ -334,10 +342,11 @@ std::string EditorWindowHostRuntime::DescribeWindows() const {
|
||||
return DescribeHostWindows(m_windows);
|
||||
}
|
||||
|
||||
void EditorWindowHostRuntime::RenderAllWindows(
|
||||
bool globalTabDragActive,
|
||||
EditorWindowWorkspaceCoordinator& workspaceCoordinator,
|
||||
EditorUtilityWindowCoordinator& utilityCoordinator) {
|
||||
void EditorWindowHostRuntime::RenderAllWindows() {
|
||||
if (m_hostCoordinator == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct WindowFrameTransferBatch {
|
||||
EditorWindow* sourceWindow = nullptr;
|
||||
EditorWindowFrameTransferRequests requests = {};
|
||||
@@ -354,7 +363,7 @@ void EditorWindowHostRuntime::RenderAllWindows(
|
||||
}
|
||||
|
||||
if (window->ConsumeSkipNextSteadyStateFrame()) {
|
||||
workspaceCoordinator.RefreshWindowPresentation(*window);
|
||||
m_hostCoordinator->RefreshWindowPresentation(*window);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -362,8 +371,8 @@ void EditorWindowHostRuntime::RenderAllWindows(
|
||||
EditorWindowFrameDriver::DriveFrame(
|
||||
*window,
|
||||
m_editorContext,
|
||||
globalTabDragActive);
|
||||
workspaceCoordinator.RefreshWindowPresentation(*window);
|
||||
m_hostCoordinator->IsGlobalTabDragActive());
|
||||
m_hostCoordinator->RefreshWindowPresentation(*window);
|
||||
if (!transferRequests.HasPendingRequests()) {
|
||||
continue;
|
||||
}
|
||||
@@ -381,10 +390,7 @@ void EditorWindowHostRuntime::RenderAllWindows(
|
||||
continue;
|
||||
}
|
||||
|
||||
workspaceCoordinator.HandleWindowFrameTransferRequests(
|
||||
*batch.sourceWindow,
|
||||
batch.requests);
|
||||
utilityCoordinator.HandleWindowFrameTransferRequests(
|
||||
m_hostCoordinator->DispatchWindowFrameTransferRequests(
|
||||
*batch.sourceWindow,
|
||||
batch.requests);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user