From 876005153ffd35163045fd305bf84205655d758c Mon Sep 17 00:00:00 2001 From: Bjorn Schobben Date: Tue, 18 Aug 2026 22:39:57 +0200 Subject: [PATCH] Viewports: do not skip SetWindowPos/Size after a leftover setter echo. NewFrame already applies PlatformRequestMove/Resize to Pos/Size. Reusing those flags to suppress the next Set made synchronous echoes (Win32 WM_MOVE) drop the following drag update, so the OS window moved every other frame. --- imgui.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 235042169..4399b77f4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -17780,19 +17780,18 @@ void ImGui::UpdatePlatformWindows() viewport->PlatformWindowCreated = true; } - // Consume requests received before this update. Callbacks raised synchronously by setters below must survive - // until the next NewFrame(), so clear the old requests before invoking platform functions instead of afterward. - const bool platform_request_move = viewport->PlatformRequestMove; - const bool platform_request_resize = viewport->PlatformRequestResize; + // Consume requests received before this update. NewFrame already applied them to Pos/Size/LastPlatform*. + // A leftover flag must not suppress a later imgui-initiated Set (e.g. continued drag after a setter echo). + // Clear before invoking platform functions so synchronous setter callbacks survive until the next NewFrame(). viewport->PlatformRequestMove = viewport->PlatformRequestResize = false; // Apply Position and Size (from ImGui to Platform/Renderer backends) - if ((viewport->LastPlatformPos.x != viewport->Pos.x || viewport->LastPlatformPos.y != viewport->Pos.y) && !platform_request_move) + if (viewport->LastPlatformPos.x != viewport->Pos.x || viewport->LastPlatformPos.y != viewport->Pos.y) { g.PlatformIO.Platform_SetWindowPos(viewport, viewport->Pos); viewport->LastPlatformPos = viewport->Pos; } - if ((viewport->LastPlatformSize.x != viewport->Size.x || viewport->LastPlatformSize.y != viewport->Size.y) && !platform_request_resize) + if (viewport->LastPlatformSize.x != viewport->Size.x || viewport->LastPlatformSize.y != viewport->Size.y) { g.PlatformIO.Platform_SetWindowSize(viewport, viewport->Size); viewport->LastPlatformSize = viewport->Size;