imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Child windows and docking + IsWindowFocused

Open MattyGroGy opened this issue 7 months ago • 3 comments

Version/Branch of Dear ImGui:

Version 1.89, Branch: docking

Back-ends:

imgui_impl_vulkan.cpp + imgui_impl_glfw3.cpp

Compiler, OS:

Windows MSVC

Full config/build information:

Dear ImGui 1.89 WIP (18808)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_WIN32_FUNCTIONS
define: _WIN32
define: _WIN64
define: _MSC_VER=1933
define: _MSVC_LANG=202002
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000040
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
--------------------------------
io.Fonts: 2 fonts, Flags: 0x00000000, TexSize: 4096,8192
io.DisplaySize: 1280.00,720.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: 3.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My Issue/Question:

I'm working with imgui and I'm trying to utilize the dockspaces as much as possible. I've been using DockBuilder to dock windows, disabling docking on those nodes after and do all the visual stuff to make them look as part of the window that they are docked into. The main reason why I'm doing this is to allow me to resize parts of the window by dragging the line between the windows.

The problem that I've run into is that when I click on the window that is docked, it gets focused and I can't use IsWindowFocused on the parent one. From what I've read on different issues, windows are not meant to propagate IsFocused to their parent, thats what child windows are for, but is there a way to dock Child Windows or to make Windows behave like child windows in this context?

Screenshots/Video:

image

Minimal, Complete and Verifiable Example code:


MattyGroGy avatar Jul 05 '24 12:07 MattyGroGy