Revert "Update new_editor inspector layout and host rendering"
This reverts commit 5d81a64ef3.
This commit is contained in:
@@ -75,13 +75,6 @@ namespace XCEngine::UI::Editor::App {
|
||||
using namespace EditorWindowSupport;
|
||||
using ::XCEngine::UI::UIPoint;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr UINT_PTR kFrameStatsRefreshTimerId = 0x58435549u;
|
||||
constexpr UINT kFrameStatsRefreshIntervalMs = 250u;
|
||||
|
||||
}
|
||||
|
||||
EditorWindow::EditorWindow(
|
||||
std::string windowId,
|
||||
std::wstring title,
|
||||
@@ -165,29 +158,20 @@ const UIEditorShellInteractionState& EditorWindow::GetShellInteractionState() co
|
||||
void EditorWindow::SetExternalDockHostDropPreview(
|
||||
const Widgets::UIEditorDockHostDropPreviewState& preview) {
|
||||
m_runtime->SetExternalDockHostDropPreview(preview);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::ClearExternalDockHostDropPreview() {
|
||||
m_runtime->ClearExternalDockHostDropPreview();
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::AttachHwnd(HWND hwnd) {
|
||||
m_state->window.hwnd = hwnd;
|
||||
m_state->window.closing = false;
|
||||
m_state->window.renderRequested = true;
|
||||
}
|
||||
|
||||
void EditorWindow::MarkDestroyed() {
|
||||
if (m_state->window.hwnd != nullptr) {
|
||||
KillTimer(m_state->window.hwnd, kFrameStatsRefreshTimerId);
|
||||
}
|
||||
m_state->window.hwnd = nullptr;
|
||||
m_state->window.closing = false;
|
||||
m_state->window.renderRequested = false;
|
||||
m_state->window.renderingFrame = false;
|
||||
m_state->window.frameStatsRefreshRequested = false;
|
||||
m_inputController->ResetWindowState();
|
||||
}
|
||||
|
||||
@@ -206,16 +190,16 @@ void EditorWindow::SetTrackingMouseLeave(bool trackingMouseLeave) {
|
||||
void EditorWindow::SetTitle(std::wstring title) {
|
||||
m_state->window.title = std::move(title);
|
||||
UpdateCachedTitleText();
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController) {
|
||||
m_runtime->ReplaceWorkspaceController(std::move(workspaceController));
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::InvalidateHostWindow() {
|
||||
RequestRender();
|
||||
void EditorWindow::InvalidateHostWindow() const {
|
||||
if (m_state->window.hwnd != nullptr && IsWindow(m_state->window.hwnd)) {
|
||||
InvalidateRect(m_state->window.hwnd, nullptr, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorWindow::Initialize(
|
||||
@@ -238,28 +222,16 @@ bool EditorWindow::Initialize(
|
||||
<< " scale=" << GetDpiScale();
|
||||
LogRuntimeTrace("window", dpiTrace.str());
|
||||
|
||||
const bool initialized = m_runtime->Initialize(
|
||||
return m_runtime->Initialize(
|
||||
m_state->window.hwnd,
|
||||
repoRoot,
|
||||
editorContext,
|
||||
captureRoot,
|
||||
autoCaptureOnStartup);
|
||||
if (initialized) {
|
||||
SetTimer(
|
||||
m_state->window.hwnd,
|
||||
kFrameStatsRefreshTimerId,
|
||||
kFrameStatsRefreshIntervalMs,
|
||||
nullptr);
|
||||
RequestRender();
|
||||
}
|
||||
return initialized;
|
||||
}
|
||||
|
||||
void EditorWindow::Shutdown() {
|
||||
ForceReleasePointerCapture();
|
||||
if (m_state->window.hwnd != nullptr && IsWindow(m_state->window.hwnd)) {
|
||||
KillTimer(m_state->window.hwnd, kFrameStatsRefreshTimerId);
|
||||
}
|
||||
|
||||
m_runtime->Shutdown();
|
||||
m_inputController->ClearPendingEvents();
|
||||
@@ -278,7 +250,6 @@ void EditorWindow::ResetInteractionState() {
|
||||
m_chromeController->SetHoveredBorderlessResizeEdge(
|
||||
Host::BorderlessWindowResizeEdge::None);
|
||||
m_chromeController->ClearPredictedClientPixelSize();
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
bool EditorWindow::ApplyWindowResize(UINT width, UINT height) {
|
||||
@@ -400,7 +371,6 @@ void EditorWindow::OnResize(UINT width, UINT height) {
|
||||
if (!matchesPredictedClientSize) {
|
||||
ApplyWindowResize(width, height);
|
||||
}
|
||||
RequestRender(false);
|
||||
}
|
||||
|
||||
void EditorWindow::OnEnterSizeMove() {
|
||||
@@ -415,7 +385,6 @@ void EditorWindow::OnExitSizeMove() {
|
||||
if (QueryCurrentClientPixelSize(width, height)) {
|
||||
ApplyWindowResize(width, height);
|
||||
}
|
||||
RequestRender(false);
|
||||
}
|
||||
|
||||
void EditorWindow::OnDpiChanged(UINT dpi, const RECT& suggestedRect) {
|
||||
@@ -444,7 +413,6 @@ void EditorWindow::OnDpiChanged(UINT dpi, const RECT& suggestedRect) {
|
||||
trace << "dpi changed to " << m_chromeController->GetWindowDpi()
|
||||
<< " scale=" << GetDpiScale();
|
||||
LogRuntimeTrace("window", trace.str());
|
||||
RequestRender(false);
|
||||
}
|
||||
|
||||
bool EditorWindow::IsVerboseRuntimeTraceEnabled() {
|
||||
@@ -634,16 +602,11 @@ EditorWindowFrameTransferRequests EditorWindow::RenderFrame(
|
||||
return {};
|
||||
}
|
||||
|
||||
const bool updateFrameTiming = !m_state->window.frameStatsRefreshRequested;
|
||||
m_state->window.renderRequested = false;
|
||||
m_state->window.frameStatsRefreshRequested = false;
|
||||
|
||||
UINT pixelWidth = 0u;
|
||||
UINT pixelHeight = 0u;
|
||||
if (!ResolveRenderClientPixelSize(pixelWidth, pixelHeight)) {
|
||||
return {};
|
||||
}
|
||||
m_state->window.renderingFrame = true;
|
||||
|
||||
const float width = PixelsToDips(static_cast<float>(pixelWidth));
|
||||
const float height = PixelsToDips(static_cast<float>(pixelHeight));
|
||||
@@ -658,12 +621,7 @@ EditorWindowFrameTransferRequests EditorWindow::RenderFrame(
|
||||
EditorWindowFrameTransferRequests transferRequests = {};
|
||||
if (editorContext.IsValid()) {
|
||||
transferRequests =
|
||||
RenderRuntimeFrame(
|
||||
editorContext,
|
||||
globalTabDragActive,
|
||||
updateFrameTiming,
|
||||
workspaceBounds,
|
||||
drawList);
|
||||
RenderRuntimeFrame(editorContext, globalTabDragActive, workspaceBounds, drawList);
|
||||
} else {
|
||||
m_frameOrchestrator->AppendInvalidFrame(editorContext, drawList);
|
||||
}
|
||||
@@ -680,10 +638,6 @@ EditorWindowFrameTransferRequests EditorWindow::RenderFrame(
|
||||
pixelWidth,
|
||||
pixelHeight,
|
||||
presentResult.framePresented);
|
||||
m_state->window.renderingFrame = false;
|
||||
if (HasInteractiveCaptureState()) {
|
||||
RequestRender(false);
|
||||
}
|
||||
return transferRequests;
|
||||
}
|
||||
|
||||
@@ -722,7 +676,6 @@ UIRect EditorWindow::ResolveWorkspaceBounds(float clientWidthDips, float clientH
|
||||
EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
|
||||
EditorContext& editorContext,
|
||||
bool globalTabDragActive,
|
||||
bool updateFrameTiming,
|
||||
const UIRect& workspaceBounds,
|
||||
UIDrawList& drawList) {
|
||||
SyncShellCapturedPointerButtonsFromSystemState();
|
||||
@@ -732,7 +685,6 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
|
||||
m_frameOrchestrator->UpdateAndAppend(
|
||||
editorContext,
|
||||
*m_runtime,
|
||||
updateFrameTiming,
|
||||
workspaceBounds,
|
||||
frameEvents,
|
||||
m_runtime->BuildCaptureStatusText(),
|
||||
@@ -893,7 +845,6 @@ void EditorWindow::QueuePointerEvent(
|
||||
ConvertClientPixelsToDips(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)),
|
||||
wParam,
|
||||
doubleClick);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueueSyntheticPointerStateSyncEvent(
|
||||
@@ -913,7 +864,6 @@ void EditorWindow::QueueSyntheticPointerStateSyncEvent(
|
||||
m_inputController->QueueSyntheticPointerStateSyncEvent(
|
||||
ConvertClientPixelsToDips(screenPoint.x, screenPoint.y),
|
||||
modifiers);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueuePointerLeaveEvent() {
|
||||
@@ -925,7 +875,6 @@ void EditorWindow::QueuePointerLeaveEvent() {
|
||||
position = ConvertClientPixelsToDips(clientPoint.x, clientPoint.y);
|
||||
}
|
||||
m_inputController->QueuePointerLeaveEvent(position);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueuePointerWheelEvent(short wheelDelta, WPARAM wParam, LPARAM lParam) {
|
||||
@@ -943,22 +892,18 @@ void EditorWindow::QueuePointerWheelEvent(short wheelDelta, WPARAM wParam, LPARA
|
||||
ConvertClientPixelsToDips(screenPoint.x, screenPoint.y),
|
||||
wheelDelta,
|
||||
wParam);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueueKeyEvent(UIInputEventType type, WPARAM wParam, LPARAM lParam) {
|
||||
m_inputController->QueueKeyEvent(type, wParam, lParam);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueueCharacterEvent(WPARAM wParam, LPARAM) {
|
||||
m_inputController->QueueCharacterEvent(wParam);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::QueueWindowFocusEvent(UIInputEventType type) {
|
||||
m_inputController->QueueWindowFocusEvent(type);
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
void EditorWindow::SyncInputModifiersFromSystemState() {
|
||||
@@ -971,48 +916,6 @@ void EditorWindow::ResetInputModifiers() {
|
||||
|
||||
void EditorWindow::RequestManualScreenshot() {
|
||||
m_runtime->RequestManualScreenshot("manual_f12");
|
||||
RequestRender();
|
||||
}
|
||||
|
||||
bool EditorWindow::HandleFrameStatsTimer(UINT_PTR timerId) {
|
||||
if (timerId != kFrameStatsRefreshTimerId) {
|
||||
return false;
|
||||
}
|
||||
if (!m_runtime->IsReady() ||
|
||||
m_state->window.hwnd == nullptr ||
|
||||
!IsWindow(m_state->window.hwnd) ||
|
||||
IsIconic(m_state->window.hwnd)) {
|
||||
return true;
|
||||
}
|
||||
if (HasInteractiveCaptureState() || HasPendingRenderRequest()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RequestFrameStatsRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorWindow::HasPendingRenderRequest() const {
|
||||
return m_state->window.renderRequested;
|
||||
}
|
||||
|
||||
void EditorWindow::RequestRender(bool invalidateHostWindow) {
|
||||
m_state->window.renderRequested = true;
|
||||
m_state->window.frameStatsRefreshRequested = false;
|
||||
if (!invalidateHostWindow ||
|
||||
m_state->window.renderingFrame ||
|
||||
m_state->window.hwnd == nullptr ||
|
||||
!IsWindow(m_state->window.hwnd)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateRect(m_state->window.hwnd, nullptr, FALSE);
|
||||
}
|
||||
|
||||
void EditorWindow::RequestFrameStatsRefresh() {
|
||||
m_state->window.frameStatsRefreshRequested = true;
|
||||
RequestRender(false);
|
||||
m_state->window.frameStatsRefreshRequested = true;
|
||||
}
|
||||
|
||||
bool EditorWindow::IsPointerInsideClientArea() const {
|
||||
|
||||
Reference in New Issue
Block a user