Dragging window flickers when using SetNextWindowDockID
Version/Branch of Dear ImGui:
Version 1.93.0, Branch: docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
Windows 10 + MSVC 2026
Full config/build information:
Dear ImGui 1.93.0 WIP (19297)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1951
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
IM_ASSERT: runs expression: OK. expand size: OK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000483
NavEnableKeyboard
NavEnableGamepad
DockingEnable
ViewportsEnable
io.ConfigDpiScaleFonts
io.ConfigDpiScaleViewports
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00003C1E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
HasMouseHoveredViewport
HasParentViewport
RendererHasVtxOffset
RendererHasTextures
RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128
io.Fonts->FontLoaderName: stb_truetype
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
Dragging docked window flickers for a frame when using ImGui::SetNextWindowDockID(dockId, ImGuiCond_Always)
If there's only one window the background flickers, if there are multiple the window ordering changes.
The flicker comes from the fact that we are undocking the window for a frame which updates ImGuiDockNode::VisibleWindow member (doesn't match our window so window->DockTabIsVisible resets). From there its just a cascade of things ending up with window->HiddenFramesCannotSkipItems getting set causing it to hide for a frame around this code. That code is probably not the issue here, we should just not be allowing undocking requests if the window has requested specific DockingId.
Maybe we should set a flag on the window inside ImGui::SetWindowDock which can be later used inside ImGui::TabItemEx for can_undock check (disable undocking if dock id was set this frame)? Adding the check doesn't prevent the user from rearranging the tabs, but maybe there could be some edge cases I have not thought through.
Screenshots/Video:
https://github.com/user-attachments/assets/6c799c7c-6e4f-41b6-9229-eb0402374e67
Minimal, Complete and Verifiable Example code:
auto dockId = ImGui::DockSpaceOverViewport();
ImGui::SetNextWindowDockID(dockId, ImGuiCond_Always);
ImGui::Begin("BugRepro");
ImGui::Text("Some text...");
ImGui::End();
Source: ocornut/imgui