feat(new_editor): wire project, inspector, and viewport runtime

This commit is contained in:
2026-04-19 00:03:25 +08:00
parent 8257403036
commit a57b322bc7
168 changed files with 14829 additions and 2507 deletions

View File

@@ -1,6 +1,7 @@
#include "WindowMessageDispatcher.h"
#include "Platform/Win32/EditorWindow.h"
#include "Platform/Win32/EditorWindowPointerCapture.h"
#include "WindowMessageHost.h"
#include <utility>
@@ -59,6 +60,13 @@ bool WindowMessageDispatcher::TryHandleChromeHoverConsumption(
const DispatchContext& context,
LPARAM lParam,
LRESULT& outResult) {
if (!App::CanConsumeEditorWindowChromeHover(
context.window.GetPointerCaptureOwner(),
context.window.GetShellRuntime().HasShellInteractiveCapture(),
context.window.GetShellRuntime().HasHostedContentCapture())) {
return false;
}
const bool resizeHoverChanged = context.window.UpdateBorderlessWindowResizeHover(lParam);
if (context.window.UpdateBorderlessWindowChromeHover(lParam)) {
context.window.InvalidateHostWindow();
@@ -93,17 +101,24 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
LRESULT& outResult) {
switch (message) {
case WM_MOUSEMOVE:
if (context.windowHost.HandleGlobalTabDragPointerMove(context.hwnd)) {
if (App::CanRouteEditorWindowGlobalTabDragPointerMessages(
context.window.GetPointerCaptureOwner(),
context.windowHost.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
context.windowHost.HandleGlobalTabDragPointerMove(context.hwnd)) {
outResult = 0;
return true;
}
if (context.window.HandleBorderlessWindowResizePointerMove(
if (App::CanRouteEditorWindowBorderlessResizePointerMessages(
context.window.GetPointerCaptureOwner()) &&
context.window.HandleBorderlessWindowResizePointerMove(
context.windowHost.GetEditorContext(),
context.windowHost.IsGlobalTabDragActive())) {
outResult = 0;
return true;
}
if (context.window.HandleBorderlessWindowChromeDragRestorePointerMove(
if (App::CanRouteEditorWindowBorderlessChromePointerMessages(
context.window.GetPointerCaptureOwner()) &&
context.window.HandleBorderlessWindowChromeDragRestorePointerMove(
context.windowHost.GetEditorContext(),
context.windowHost.IsGlobalTabDragActive())) {
outResult = 0;
@@ -129,6 +144,9 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
outResult = 0;
return true;
case WM_LBUTTONDOWN:
if (context.windowHost.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) {
context.windowHost.EndGlobalTabDragSession();
}
if (context.window.HandleBorderlessWindowResizeButtonDown(lParam)) {
outResult = 0;
return true;
@@ -138,6 +156,7 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
return true;
}
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Left,
@@ -145,16 +164,43 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
lParam);
outResult = 0;
return true;
case WM_RBUTTONDOWN:
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Right,
wParam,
lParam);
outResult = 0;
return true;
case WM_MBUTTONDOWN:
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Middle,
wParam,
lParam);
outResult = 0;
return true;
case WM_LBUTTONUP:
if (context.windowHost.HandleGlobalTabDragPointerButtonUp(context.hwnd)) {
if (App::CanRouteEditorWindowGlobalTabDragPointerMessages(
context.window.GetPointerCaptureOwner(),
context.windowHost.OwnsActiveGlobalTabDrag(context.window.GetWindowId())) &&
context.windowHost.HandleGlobalTabDragPointerButtonUp(context.hwnd)) {
outResult = 0;
return true;
}
if (context.window.HandleBorderlessWindowResizeButtonUp()) {
if (App::CanRouteEditorWindowBorderlessResizePointerMessages(
context.window.GetPointerCaptureOwner()) &&
context.window.HandleBorderlessWindowResizeButtonUp()) {
outResult = 0;
return true;
}
if (context.window.HandleBorderlessWindowChromeButtonUp(
if (App::CanRouteEditorWindowBorderlessChromePointerMessages(
context.window.GetPointerCaptureOwner()) &&
context.window.HandleBorderlessWindowChromeButtonUp(
context.windowHost.GetEditorContext(),
context.windowHost.IsGlobalTabDragActive(),
lParam)) {
@@ -168,6 +214,22 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
lParam);
outResult = 0;
return true;
case WM_RBUTTONUP:
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonUp,
::XCEngine::UI::UIPointerButton::Right,
wParam,
lParam);
outResult = 0;
return true;
case WM_MBUTTONUP:
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonUp,
::XCEngine::UI::UIPointerButton::Middle,
wParam,
lParam);
outResult = 0;
return true;
case WM_LBUTTONDBLCLK:
if (context.window.HandleBorderlessWindowChromeDoubleClick(
context.windowHost.GetEditorContext(),
@@ -176,7 +238,35 @@ bool WindowMessageDispatcher::TryDispatchWindowPointerMessage(
outResult = 0;
return true;
}
return false;
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Left,
wParam,
lParam);
outResult = 0;
return true;
case WM_RBUTTONDBLCLK:
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Right,
wParam,
lParam);
outResult = 0;
return true;
case WM_MBUTTONDBLCLK:
SetFocus(context.hwnd);
context.window.TryStartImmediateShellPointerCapture(lParam);
context.window.QueuePointerEvent(
::XCEngine::UI::UIInputEventType::PointerButtonDown,
::XCEngine::UI::UIPointerButton::Middle,
wParam,
lParam);
outResult = 0;
return true;
case WM_MOUSEWHEEL:
context.window.QueuePointerWheelEvent(GET_WHEEL_DELTA_WPARAM(wParam), wParam, lParam);
outResult = 0;
@@ -208,6 +298,9 @@ bool WindowMessageDispatcher::TryDispatchWindowInputMessage(
outResult = 0;
return true;
case WM_CAPTURECHANGED:
if (reinterpret_cast<HWND>(lParam) != context.hwnd) {
context.window.ClearPointerCaptureOwner();
}
if (context.windowHost.OwnsActiveGlobalTabDrag(context.window.GetWindowId()) &&
reinterpret_cast<HWND>(lParam) != context.hwnd) {
context.windowHost.EndGlobalTabDragSession();