fix(new_editor): reduce live resize jitter

This commit is contained in:
2026-04-22 21:08:36 +08:00
parent 34c635ba22
commit ad98660b1d
13 changed files with 232 additions and 33 deletions

View File

@@ -362,40 +362,38 @@ bool EditorWindow::TryResolveDockTabDropTarget(
return outTarget.valid;
}
void EditorWindow::OnResize(UINT width, UINT height) {
bool matchesPredictedClientSize = false;
UINT predictedWidth = 0u;
UINT predictedHeight = 0u;
if (m_chromeController->TryGetPredictedClientPixelSize(
predictedWidth,
predictedHeight)) {
matchesPredictedClientSize =
predictedWidth == width &&
predictedHeight == height;
bool EditorWindow::OnResize(UINT width, UINT height) {
const bool matchedPresentedPrediction =
m_chromeController->ConsumePresentedPredictedClientPixelSizeMatch(width, height);
if (!matchedPresentedPrediction) {
m_chromeController->ClearPredictedClientPixelSize();
}
m_chromeController->ClearPredictedClientPixelSize();
if (IsBorderlessWindowEnabled() && m_state->window.hwnd != nullptr) {
Host::RefreshBorderlessWindowDwmDecorations(m_state->window.hwnd);
}
if (!matchesPredictedClientSize) {
ApplyWindowResize(width, height);
if (matchedPresentedPrediction) {
return false;
}
ApplyWindowResize(width, height);
return true;
}
void EditorWindow::OnEnterSizeMove() {
m_chromeController->BeginInteractiveResize();
}
void EditorWindow::OnExitSizeMove() {
bool EditorWindow::OnExitSizeMove() {
m_chromeController->EndInteractiveResize();
m_chromeController->ClearPredictedClientPixelSize();
UINT width = 0u;
UINT height = 0u;
if (QueryCurrentClientPixelSize(width, height)) {
ApplyWindowResize(width, height);
return true;
}
return false;
}
void EditorWindow::OnDpiChanged(UINT dpi, const RECT& suggestedRect) {
@@ -658,6 +656,7 @@ EditorWindowFrameTransferRequests EditorWindow::OnPaintMessage(
BeginPaint(m_state->window.hwnd, &paintStruct);
const EditorWindowFrameTransferRequests transferRequests =
RenderFrame(editorContext, globalTabDragActive);
m_chromeController->RequestSkipNextSteadyStateFrame();
EndPaint(m_state->window.hwnd, &paintStruct);
return transferRequests;
}