Refactor new editor state ownership model
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Platform/Win32/EditorWindowInternalState.h"
|
||||
#include "Platform/Win32/EditorWindowRuntimeInternal.h"
|
||||
#include "Platform/Win32/EditorWindowStyle.h"
|
||||
#include "Composition/EditorShellPointerInteraction.h"
|
||||
#include "State/EditorContext.h"
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
@@ -218,7 +219,7 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
|
||||
"input",
|
||||
DescribeInputEvents(frameEvents) + " | " +
|
||||
editorContext.DescribeWorkspaceState(
|
||||
m_state->composition.workspaceController,
|
||||
GetWorkspaceController(),
|
||||
m_state->composition.shellRuntime.GetShellInteractionState()));
|
||||
}
|
||||
|
||||
@@ -230,9 +231,10 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
|
||||
|
||||
editorContext.AttachTextMeasurer(m_state->render.renderer);
|
||||
const bool useDetachedTitleBarTabStrip = ShouldUseDetachedTitleBarTabStrip();
|
||||
UIEditorWorkspaceController& workspaceController = GetMutableWorkspaceController();
|
||||
m_state->composition.shellRuntime.Update(
|
||||
editorContext,
|
||||
m_state->composition.workspaceController,
|
||||
workspaceController,
|
||||
workspaceBounds,
|
||||
frameEvents,
|
||||
BuildCaptureStatusText(),
|
||||
@@ -253,12 +255,11 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
|
||||
const EditorWindowFrameTransferRequests transferRequests =
|
||||
BuildShellTransferRequests(globalTabDragActive, dockHostInteractionState, shellFrame);
|
||||
|
||||
ApplyHostCaptureRequests(shellFrame.result);
|
||||
ApplyShellRuntimePointerCapture();
|
||||
for (const WorkspaceTraceEntry& entry :
|
||||
m_state->composition.shellRuntime.GetTraceEntries()) {
|
||||
LogRuntimeTrace(entry.channel, entry.message);
|
||||
}
|
||||
ApplyHostedContentCaptureRequests();
|
||||
ApplyCurrentCursor();
|
||||
m_state->composition.shellRuntime.Append(drawList);
|
||||
if (frameContext.canRenderViewports) {
|
||||
@@ -303,7 +304,7 @@ void EditorWindow::LogFrameInteractionTrace(
|
||||
<< " commandExecuted="
|
||||
<< (shellFrame.result.workspaceResult.dockHostResult.commandExecuted ? "true" : "false")
|
||||
<< " active="
|
||||
<< m_state->composition.workspaceController.GetWorkspace().activePanelId
|
||||
<< GetWorkspaceController().GetWorkspace().activePanelId
|
||||
<< " message="
|
||||
<< shellFrame.result.workspaceResult.dockHostResult.layoutResult.message;
|
||||
LogRuntimeTrace("frame", frameTrace.str());
|
||||
@@ -375,22 +376,24 @@ void EditorWindow::SyncShellCapturedPointerButtonsFromSystemState() {
|
||||
QueueSyntheticPointerStateSyncEvent(modifiers);
|
||||
}
|
||||
|
||||
void EditorWindow::ApplyHostCaptureRequests(const UIEditorShellInteractionResult& result) {
|
||||
if (result.requestPointerCapture) {
|
||||
void EditorWindow::ApplyShellRuntimePointerCapture() {
|
||||
const EditorShellPointerOwner owner =
|
||||
m_state->composition.shellRuntime.GetPointerOwner();
|
||||
if (IsShellPointerOwner(owner)) {
|
||||
AcquirePointerCapture(EditorWindowPointerCaptureOwner::Shell);
|
||||
return;
|
||||
}
|
||||
if (result.releasePointerCapture) {
|
||||
|
||||
if (IsHostedContentPointerOwner(owner)) {
|
||||
AcquirePointerCapture(EditorWindowPointerCaptureOwner::HostedContent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OwnsPointerCapture(EditorWindowPointerCaptureOwner::Shell)) {
|
||||
ReleasePointerCapture(EditorWindowPointerCaptureOwner::Shell);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorWindow::ApplyHostedContentCaptureRequests() {
|
||||
if (m_state->composition.shellRuntime.WantsHostPointerCapture()) {
|
||||
AcquirePointerCapture(EditorWindowPointerCaptureOwner::HostedContent);
|
||||
}
|
||||
|
||||
if (m_state->composition.shellRuntime.WantsHostPointerRelease() &&
|
||||
!m_state->composition.shellRuntime.HasShellInteractiveCapture()) {
|
||||
if (OwnsPointerCapture(EditorWindowPointerCaptureOwner::HostedContent)) {
|
||||
ReleasePointerCapture(EditorWindowPointerCaptureOwner::HostedContent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user