Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child windows and docking + IsWindowFocused #7770

Open
MattyGroGy opened this issue Jul 5, 2024 · 3 comments
Open

Child windows and docking + IsWindowFocused #7770

MattyGroGy opened this issue Jul 5, 2024 · 3 comments

Comments

@MattyGroGy
Copy link

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:

@GamingMinds-DanielC
Copy link
Contributor

If you can update your ImGui version, you can use manually resizable child windows (introduced in 1.90).

@ocornut
Copy link
Owner

ocornut commented Jul 5, 2024

You may also call IsWindowFocused(ImGuiFocusedFlags_DockHierarchy);

@MattyGroGy
Copy link
Author

In what context dopes IsWindowFocused(ImGuiFocusedFlags_DockHierarchy); return true?
If I all it right before ImGui::End of parent window, does it return true? Or do I have to call it inside each of the windows?
Can I somehow propagate it to highlight the tab bar in dock to show that the window is focused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants