mirror of
https://github.com/ocornut/imgui.git
synced 2026-10-29 07:54:40 +00:00
Dragging window flickers when using SetNextWindowDockID #9544
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#9544
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
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.
I don't have much to say here, maybe we should set a flag on the window inside
ImGui::SetWindowDockwhich can be later used insideImGui::TabItemExforcan_undockcheck (disable undocking if dock id was set this frame)?The flicker comes from the fact that we are undocking the window for a frame which updates
ImGuiDockNode::VisibleWindowmember (doesn't match our window sowindow->DockTabIsVisibleresets). From there its just a cascade of things ending up withwindow->HiddenFramesCannotSkipItemsgetting 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 DockingIDScreenshots/Video:
https://github.com/user-attachments/assets/6c799c7c-6e4f-41b6-9229-eb0402374e67
Minimal, Complete and Verifiable Example code:
Technically, setting the dock id to the current dock id is a no op with extra steps. Even though you do it every frame (which looks more like a bad hack), ImGui can't know that you will do it again next frame, it would have to guess your intentions. To make your intentions clear, you could set up the dock node with
ImGuiDockNodeFlags_NoUndocking.The minimal example looks hacky but I am sure we can have real applications using a similar pattern to keep windows pinned to a dockspsace?
SetNextWindowDockID()If theres a better solution I would be interested to learn about it.
EDIT:
ImGuiWindowFlags_NoMoveseems to work too, I can update my code to use that. Thanks for pointing it out :)