Refactor editor windowing boundaries

This commit is contained in:
2026-04-25 19:25:49 +08:00
parent f7ddd58f78
commit 9ab1beb2c4
23 changed files with 396 additions and 304 deletions

View File

@@ -15,6 +15,7 @@
#include <XCEngine/UI/Types.h>
#include <cassert>
#include <algorithm>
#include <optional>
#include <sstream>
#include <windowsx.h>
#include <XCEngine/UI/DrawData.h>
@@ -55,12 +56,7 @@ UINT QueryWindowDpi(HWND hwnd) {
}
bool ResolveVerboseRuntimeTraceEnabled() {
wchar_t buffer[8] = {};
const DWORD length = GetEnvironmentVariableW(
L"XCUIEDITOR_VERBOSE_TRACE",
buffer,
static_cast<DWORD>(std::size(buffer)));
return length > 0u && buffer[0] != L'0';
return IsEditorWindowVerboseRuntimeTraceEnabled();
}
void LogRuntimeTrace(std::string_view channel, std::string_view message) {
@@ -164,6 +160,14 @@ const UIEditorWorkspaceController& EditorWindow::GetWorkspaceController() const
return *workspaceController;
}
EditorWindowDockHostBinding* EditorWindow::TryGetDockHostBinding() {
return m_runtime->TryGetDockHostBinding();
}
const EditorWindowDockHostBinding* EditorWindow::TryGetDockHostBinding() const {
return m_runtime->TryGetDockHostBinding();
}
void EditorWindow::AttachHwnd(HWND hwnd) {
m_session->AttachHwnd(hwnd);
}
@@ -474,6 +478,18 @@ using ::XCEngine::UI::UIRect;
namespace {
std::optional<EditorWindowScreenPoint> QueryCursorScreenPoint() {
POINT screenPoint = {};
if (!GetCursorPos(&screenPoint)) {
return std::nullopt;
}
return EditorWindowScreenPoint{
.x = screenPoint.x,
.y = screenPoint.y,
};
}
std::uint8_t ButtonMask(UIPointerButton button) {
switch (button) {
case UIPointerButton::Left: return 1u << 0u;
@@ -646,6 +662,7 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
.editorContext = editorContext,
.bounds = workspaceBounds,
.inputEvents = frameEvents,
.cursorScreenPoint = QueryCursorScreenPoint(),
.captureStatusText = m_runtime->BuildCaptureStatusText(),
.primary = m_session->IsPrimary(),
.globalTabDragActive = globalTabDragActive,