refactor(new_editor): extract window content boundary

This commit is contained in:
2026-04-22 20:32:56 +08:00
parent 6efbaf450e
commit e251b77d0d
19 changed files with 1223 additions and 234 deletions

View File

@@ -6,7 +6,6 @@
#include "Platform/Win32/EditorWindowSupport.h"
#include <XCEditor/Foundation/UIEditorTheme.h>
#include <XCEditor/Workspace/UIEditorDetachedWindowPolicy.h>
#include <XCEngine/UI/DrawData.h>
#include <XCEngine/UI/Layout/UITabStripLayout.h>
@@ -230,8 +229,7 @@ bool EditorWindowChromeController::HandleSystemCommand(
bool EditorWindowChromeController::HandleGetMinMaxInfo(
const EditorWindow& window,
LPARAM lParam) const {
const ::XCEngine::UI::UISize minimumOuterSize =
ResolveUIEditorDetachedWorkspaceMinimumOuterSize(window.GetWorkspaceController());
const ::XCEngine::UI::UISize minimumOuterSize = window.m_runtime->ResolveMinimumOuterSize();
return Host::HandleBorderlessWindowGetMinMaxInfo(
window.m_state->window.hwnd,
lParam,
@@ -311,8 +309,7 @@ bool EditorWindowChromeController::HandleResizePointerMove(
return false;
}
const ::XCEngine::UI::UISize minimumOuterSize =
ResolveUIEditorDetachedWorkspaceMinimumOuterSize(window.GetWorkspaceController());
const ::XCEngine::UI::UISize minimumOuterSize = window.m_runtime->ResolveMinimumOuterSize();
RECT targetRect = Host::ComputeBorderlessWindowResizeRect(
GetBorderlessResizeInitialWindowRect(),
GetBorderlessResizeInitialScreenPoint(),
@@ -330,7 +327,7 @@ bool EditorWindowChromeController::HandleResizePointerMove(
static_cast<UINT>(width),
static_cast<UINT>(height));
window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height));
window.RequestFrame(EditorWindowFrameRequestReason::BorderlessTransition);
(void)window.RenderFrame(editorContext, globalTabDragActive);
SetWindowPos(
window.m_state->window.hwnd,
@@ -618,9 +615,7 @@ Host::BorderlessWindowChromeLayout EditorWindowChromeController::ResolveChromeLa
float leadingOccupiedRight = 0.0f;
if (ShouldUseDetachedTitleBarTabStrip(window)) {
leadingOccupiedRight = ResolveDetachedTabWidth(
ResolveUIEditorDetachedWorkspaceTitle(
window.GetWorkspaceController(),
"Panel"),
window.m_runtime->ResolveTabStripTitleText("Panel"),
&window.m_runtime->GetTextMeasurer());
}
@@ -632,8 +627,7 @@ Host::BorderlessWindowChromeLayout EditorWindowChromeController::ResolveChromeLa
bool EditorWindowChromeController::ShouldUseDetachedTitleBarTabStrip(
const EditorWindow& window) const {
return !window.m_state->window.primary &&
!IsUIEditorDetachedWorkspaceToolWindow(window.m_runtime->GetWorkspaceController()) &&
HasUIEditorSingleVisibleRootTab(window.m_runtime->GetWorkspaceController());
window.m_runtime->ShouldUseDetachedTitleBarTabStrip();
}
void EditorWindowChromeController::AppendChrome(
@@ -689,13 +683,10 @@ void EditorWindowChromeController::AppendChrome(
0.0f,
(layout.titleBarRect.height - kBorderlessTitleBarFontSize) * 0.5f -
1.0f)),
IsUIEditorDetachedWorkspaceToolWindow(window.GetWorkspaceController())
? ResolveUIEditorDetachedWorkspaceTitle(
window.GetWorkspaceController(),
"Panel")
: (window.m_state->window.titleText.empty()
? std::string("XCEngine Editor")
: window.m_state->window.titleText),
window.m_runtime->ResolveDetachedWindowTitleText(
window.m_state->window.titleText.empty()
? std::string_view("XCEngine Editor")
: std::string_view(window.m_state->window.titleText)),
kShellTextColor,
kBorderlessTitleBarFontSize);
}
@@ -817,6 +808,7 @@ bool EditorWindowChromeController::ApplyPredictedWindowRectTransition(
SetPredictedClientPixelSize(static_cast<UINT>(width), static_cast<UINT>(height));
window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height));
(void)window.RenderFrame(editorContext, globalTabDragActive);
SetWindowPos(
window.m_state->window.hwnd,
nullptr,
@@ -825,7 +817,6 @@ bool EditorWindowChromeController::ApplyPredictedWindowRectTransition(
width,
height,
SWP_NOZORDER | SWP_NOACTIVATE);
window.RequestFrame(EditorWindowFrameRequestReason::BorderlessTransition);
window.InvalidateHostWindow();
return true;
}