Refactor editor window runtime ownership
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
#include "Platform/Win32/Chrome/EditorWindowChromeController.h"
|
||||
#include "Platform/Win32/Runtime/EditorWindowInputController.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindow.h"
|
||||
#include "Windowing/Runtime/EditorWindowRuntimeController.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindowPointerCapture.h"
|
||||
#include "Windowing/Content/EditorWindowContentController.h"
|
||||
#include "Windowing/Host/EditorWindowHostCoordinator.h"
|
||||
|
||||
#include <cstdint>
|
||||
@@ -31,14 +31,14 @@ void EditorWindowMessageDispatcher::DispatchWindowFrameTransferRequests(
|
||||
const DispatchContext& context,
|
||||
const EditorWindowFrameTransferRequests& transferRequests) {
|
||||
context.hostCoordinator.DispatchWindowFrameTransferRequests(
|
||||
context.window,
|
||||
context.window.GetOwner(),
|
||||
transferRequests);
|
||||
}
|
||||
|
||||
void EditorWindowMessageDispatcher::FinalizeImmediateFrame(
|
||||
const DispatchContext& context,
|
||||
const EditorWindowFrameTransferRequests& transferRequests) {
|
||||
context.hostCoordinator.RefreshWindowPresentation(context.window);
|
||||
context.hostCoordinator.RefreshWindowPresentation(context.window.GetOwner());
|
||||
if (!transferRequests.HasPendingRequests()) {
|
||||
return;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void EditorWindowMessageDispatcher::FlushQueuedCompletedImmediateFrame(
|
||||
void EditorWindowMessageDispatcher::RenderAndHandleWindowFrame(const DispatchContext& context) {
|
||||
FinalizeImmediateFrame(
|
||||
context,
|
||||
context.hostCoordinator.DriveImmediateWindowFrame(context.window));
|
||||
context.hostCoordinator.DriveImmediateWindowFrame(context.window.GetOwner()));
|
||||
}
|
||||
|
||||
bool EditorWindowMessageDispatcher::EnsureTrackingMouseLeave(const DispatchContext& context) {
|
||||
@@ -87,7 +87,7 @@ bool EditorWindowMessageDispatcher::TryHandleChromeHoverConsumption(
|
||||
EditorWindowInputController& inputController = *context.window.m_inputController;
|
||||
EditorWindowChromeController& chromeController = *context.window.m_chromeController;
|
||||
const EditorWindowInputFeedbackBinding* inputFeedbackBinding =
|
||||
context.window.m_runtime->TryGetInputFeedbackBinding();
|
||||
context.window.GetOwner().TryGetInputFeedbackBinding();
|
||||
|
||||
if (!CanConsumeEditorWindowChromeHover(
|
||||
inputController.GetPointerCaptureOwner(),
|
||||
@@ -139,8 +139,10 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
case WM_MOUSEMOVE:
|
||||
if (CanRouteEditorWindowGlobalTabDragPointerMessages(
|
||||
inputController.GetPointerCaptureOwner(),
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerMove(context.window)) {
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(
|
||||
context.window.GetOwner().GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerMove(
|
||||
context.window.GetOwner())) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -180,7 +182,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_LBUTTONDOWN:
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) {
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(
|
||||
context.window.GetOwner().GetWindowId())) {
|
||||
context.hostCoordinator.EndGlobalTabDragSession();
|
||||
}
|
||||
if (chromeController.HandleResizeButtonDown(context.window, lParam)) {
|
||||
@@ -226,8 +229,10 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowPointerMessage(
|
||||
case WM_LBUTTONUP:
|
||||
if (CanRouteEditorWindowGlobalTabDragPointerMessages(
|
||||
inputController.GetPointerCaptureOwner(),
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerButtonUp(context.window)) {
|
||||
context.hostCoordinator.OwnsActiveGlobalTabDrag(
|
||||
context.window.GetOwner().GetWindowId())) &&
|
||||
context.hostCoordinator.HandleGlobalTabDragPointerButtonUp(
|
||||
context.window.GetOwner())) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -343,7 +348,8 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowInputMessage(
|
||||
if (reinterpret_cast<HWND>(lParam) != context.hwnd) {
|
||||
inputController.ClearPointerCaptureOwner();
|
||||
}
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(context.window.GetWindowId()) &&
|
||||
if (context.hostCoordinator.OwnsActiveGlobalTabDrag(
|
||||
context.window.GetOwner().GetWindowId()) &&
|
||||
reinterpret_cast<HWND>(lParam) != context.hwnd) {
|
||||
context.hostCoordinator.EndGlobalTabDragSession();
|
||||
outResult = 0;
|
||||
@@ -367,7 +373,7 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowInputMessage(
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (wParam == VK_F12) {
|
||||
context.window.m_runtime->RequestManualScreenshot("manual_f12");
|
||||
context.window.GetOwner().RequestManualScreenshot("manual_f12");
|
||||
}
|
||||
inputController.QueueKeyEvent(::XCEngine::UI::UIInputEventType::KeyDown, wParam, lParam);
|
||||
outResult = 0;
|
||||
@@ -425,7 +431,7 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowLifecycleMessage(
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_CLOSE:
|
||||
context.hostCoordinator.ExecuteCloseRequest(context.window);
|
||||
context.hostCoordinator.ExecuteCloseRequest(context.window.GetOwner());
|
||||
outResult = 0;
|
||||
return true;
|
||||
case WM_PAINT:
|
||||
@@ -433,7 +439,7 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowLifecycleMessage(
|
||||
PAINTSTRUCT paintStruct = {};
|
||||
BeginPaint(context.hwnd, &paintStruct);
|
||||
const EditorWindowFrameTransferRequests transferRequests =
|
||||
context.hostCoordinator.DriveImmediateWindowFrame(context.window);
|
||||
context.hostCoordinator.DriveImmediateWindowFrame(context.window.GetOwner());
|
||||
EndPaint(context.hwnd, &paintStruct);
|
||||
FinalizeImmediateFrame(context, transferRequests);
|
||||
outResult = 0;
|
||||
@@ -443,7 +449,7 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowLifecycleMessage(
|
||||
outResult = 1;
|
||||
return true;
|
||||
case WM_DESTROY:
|
||||
context.hostCoordinator.HandleNativeWindowDestroyed(context.window);
|
||||
context.hostCoordinator.HandleNativeWindowDestroyed(context.window.GetOwner());
|
||||
outResult = 0;
|
||||
return true;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user