Refactor editor windowing boundaries
This commit is contained in:
@@ -7,10 +7,7 @@
|
||||
#include "Platform/Win32/Runtime/EditorWindowFrameDriver.h"
|
||||
#include "Platform/Win32/Runtime/EditorWindowRuntimeController.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindowPointerCapture.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindowHostRuntime.h"
|
||||
#include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h"
|
||||
#include "Windowing/Coordinator/EditorUtilityWindowCoordinator.h"
|
||||
#include "Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h"
|
||||
#include "Windowing/Host/EditorWindowHostCoordinator.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
@@ -27,20 +24,14 @@ constexpr UINT kMessageNcUaDrawFrame = 0x00AFu;
|
||||
|
||||
struct EditorWindowMessageDispatcher::DispatchContext {
|
||||
HWND hwnd = nullptr;
|
||||
EditorWindowHostRuntime& hostRuntime;
|
||||
EditorWindowLifecycleCoordinator& lifecycleCoordinator;
|
||||
EditorUtilityWindowCoordinator& utilityCoordinator;
|
||||
EditorWindowWorkspaceCoordinator& workspaceCoordinator;
|
||||
EditorWindowHostCoordinator& hostCoordinator;
|
||||
EditorWindow& window;
|
||||
};
|
||||
|
||||
void EditorWindowMessageDispatcher::DispatchWindowFrameTransferRequests(
|
||||
const DispatchContext& context,
|
||||
const EditorWindowFrameTransferRequests& transferRequests) {
|
||||
context.workspaceCoordinator.HandleWindowFrameTransferRequests(
|
||||
context.window,
|
||||
transferRequests);
|
||||
context.utilityCoordinator.HandleWindowFrameTransferRequests(
|
||||
context.hostCoordinator.DispatchWindowFrameTransferRequests(
|
||||
context.window,
|
||||
transferRequests);
|
||||
}
|
||||
@@ -48,7 +39,7 @@ void EditorWindowMessageDispatcher::DispatchWindowFrameTransferRequests(
|
||||
void EditorWindowMessageDispatcher::FinalizeImmediateFrame(
|
||||
const DispatchContext& context,
|
||||
const EditorWindowFrameTransferRequests& transferRequests) {
|
||||
context.workspaceCoordinator.RefreshWindowPresentation(context.window);
|
||||
context.hostCoordinator.RefreshWindowPresentation(context.window);
|
||||
if (!transferRequests.HasPendingRequests()) {
|
||||
return;
|
||||
}
|
||||
@@ -72,8 +63,8 @@ void EditorWindowMessageDispatcher::RenderAndHandleWindowFrame(const DispatchCon
|
||||
context,
|
||||
EditorWindowFrameDriver::DriveImmediateFrame(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive()));
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive()));
|
||||
}
|
||||
|
||||
bool EditorWindowMessageDispatcher::EnsureTrackingMouseLeave(const DispatchContext& context) {
|
||||
@@ -152,8 +143,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
case WM_MOUSEMOVE:
|
||||
if (CanRouteEditorWindowGlobalTabDragPointerMessages(
|
||||
inputController.GetPointerCaptureOwner(),
|
||||
context.workspaceCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.workspaceCoordinator.HandleGlobalTabDragPointerMove(context.window)) {
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerMove(context.window)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -161,8 +152,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
inputController.GetPointerCaptureOwner()) &&
|
||||
chromeController.HandleResizePointerMove(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive())) {
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive())) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -170,8 +161,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
inputController.GetPointerCaptureOwner()) &&
|
||||
chromeController.HandleChromeDragRestorePointerMove(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive())) {
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive())) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -195,8 +186,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_LBUTTONDOWN:
|
||||
if (context.workspaceCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) {
|
||||
context.workspaceCoordinator.EndGlobalTabDragSession();
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) {
|
||||
context.hostCoordinator.EndGlobalTabDragSession();
|
||||
}
|
||||
if (chromeController.HandleResizeButtonDown(context.window, lParam)) {
|
||||
outResult = 0;
|
||||
@@ -241,8 +232,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
case WM_LBUTTONUP:
|
||||
if (CanRouteEditorWindowGlobalTabDragPointerMessages(
|
||||
inputController.GetPointerCaptureOwner(),
|
||||
context.workspaceCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.workspaceCoordinator.HandleGlobalTabDragPointerButtonUp(context.window)) {
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerButtonUp(context.window)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -256,8 +247,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
inputController.GetPointerCaptureOwner()) &&
|
||||
chromeController.HandleChromeButtonUp(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive(),
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive(),
|
||||
lParam)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
@@ -288,8 +279,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
case WM_LBUTTONDBLCLK:
|
||||
if (chromeController.HandleChromeDoubleClick(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive(),
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive(),
|
||||
lParam)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
@@ -360,9 +351,9 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowInputMessage(
|
||||
if (reinterpret_cast<HWND>(lParam) != context.hwnd) {
|
||||
inputController.ClearPointerCaptureOwner();
|
||||
}
|
||||
if (context.workspaceCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId()) &&
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId()) &&
|
||||
reinterpret_cast<HWND>(lParam) != context.hwnd) {
|
||||
context.workspaceCoordinator.EndGlobalTabDragSession();
|
||||
context.hostCoordinator.EndGlobalTabDragSession();
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -442,22 +433,22 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowLifecycleMessage(
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_CLOSE:
|
||||
context.lifecycleCoordinator.ExecuteCloseRequest(context.window);
|
||||
context.hostCoordinator.ExecuteCloseRequest(context.window);
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_PAINT:
|
||||
FinalizeImmediateFrame(
|
||||
context,
|
||||
context.window.OnPaintMessage(
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive()));
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive()));
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_ERASEBKGND:
|
||||
outResult = 1;
|
||||
return true;
|
||||
case WM_DESTROY:
|
||||
context.lifecycleCoordinator.HandleNativeWindowDestroyed(context.window);
|
||||
context.hostCoordinator.HandleNativeWindowDestroyed(context.window);
|
||||
outResult = 0;
|
||||
return true;
|
||||
default:
|
||||
@@ -497,8 +488,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowChromeMessage(
|
||||
case WM_SYSCOMMAND:
|
||||
if (chromeController.HandleSystemCommand(
|
||||
context.window,
|
||||
context.hostRuntime.GetEditorContext(),
|
||||
context.workspaceCoordinator.IsGlobalTabDragActive(),
|
||||
context.hostCoordinator.GetEditorContext(),
|
||||
context.hostCoordinator.IsGlobalTabDragActive(),
|
||||
wParam)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
@@ -517,10 +508,7 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowChromeMessage(
|
||||
|
||||
bool EditorWindowMessageDispatcher::TryDispatch(
|
||||
HWND hwnd,
|
||||
EditorWindowHostRuntime& hostRuntime,
|
||||
EditorWindowLifecycleCoordinator& lifecycleCoordinator,
|
||||
EditorUtilityWindowCoordinator& utilityCoordinator,
|
||||
EditorWindowWorkspaceCoordinator& workspaceCoordinator,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
EditorWindow& window,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
@@ -528,10 +516,7 @@ bool EditorWindowMessageDispatcher::TryDispatch(
|
||||
LRESULT& outResult) {
|
||||
const DispatchContext context = {
|
||||
.hwnd = hwnd,
|
||||
.hostRuntime = hostRuntime,
|
||||
.lifecycleCoordinator = lifecycleCoordinator,
|
||||
.utilityCoordinator = utilityCoordinator,
|
||||
.workspaceCoordinator = workspaceCoordinator,
|
||||
.hostCoordinator = hostCoordinator,
|
||||
.window = window,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user