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

Issues with docking in window with no padding #2717

Closed
leiradel opened this issue Aug 7, 2019 · 6 comments
Closed

Issues with docking in window with no padding #2717

leiradel opened this issue Aug 7, 2019 · 6 comments
Labels

Comments

@leiradel
Copy link

leiradel commented Aug 7, 2019

Version/Branch of Dear ImGui:

Version: v1.72b
Branch: docking

Dear ImGui 1.72b (17202)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201103
define: __linux__
define: __GNUC__=7
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl
io.BackendRendererName: imgui_impl_opengl2
io.ConfigFlags: 0x00000040
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.BackendFlags: 0x00001402
 HasMouseCursors
 PlatformHasViewports
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 1024,2048
io.DisplaySize: 1213.00,665.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

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
Compiler: gcc 7.4.0
Operating System: Ubuntu 18.04.2 LTS 64-bit

My Issue/Question:

I'm trying to make an invible window that stays in the background and takes the entire app window size to serve as a base where other windows can dock.

Everything works fine but when I try to remove the padding from that window, the first window that is docked is maximized instead.

Screenshots/Video

  1. Drag a window by the title

Screenshot from 2019-08-07 22-20-12

  1. Dock it anywhere

Screenshot from 2019-08-07 22-20-28

  1. It will become maximized instead of docked

Screenshot from 2019-08-07 22-20-32

Standalone, minimal, complete and verifiable example:

Here.

@leiradel
Copy link
Author

leiradel commented Aug 7, 2019

What I'm trying to accomplish with that window is just having a dock space that covers the entire app window. I know I can dock windows into one another, but then I have to manually resize everything to try to cover the entire client area of the app window.

@ocornut
Copy link
Owner

ocornut commented Aug 7, 2019 via email

@leiradel
Copy link
Author

leiradel commented Aug 7, 2019

The code is similar but uses PushStyleVar instead of messing with things in GetStyle(). However, DockSpaceOverViewport() does exactly what I need and works like a charm. Thanks!

I'll leave this open since there may be a bug, like you said.

@ocornut ocornut added the docking label Aug 8, 2019
@ocornut ocornut added the drag drop drag and drop label Oct 15, 2020
ocornut pushed a commit that referenced this issue Oct 15, 2020
…osen the later one. Fixes dragging into a full-window-sized dockspace inside a zero-padded window. (#3519, #2717)
@ocornut
Copy link
Owner

ocornut commented Oct 15, 2020

This got fixed by @Black-Cat in #3519, apologies for not reacting on this since you found `DockSpaceOverViewport().

The reason I couldn't immediately understand the issue is that it would only happen if the host window doesn't have the ImGuiWindowFlags_NoDocking flags, which is kind of a user-error. But as you showed the resulting error was quite confusing and could be misleading.

I will also alter the Demo to point users toward DockSpaceOverViewport(). Since 1.76 it plays nicely with main menu bar and I think the only reason the demo doesn't use it right now is because it wants a local menu bar. Going to try to see if I can simply use DockSpaceOverViewport() directly..

@ocornut ocornut closed this as completed Oct 15, 2020
@ocornut
Copy link
Owner

ocornut commented Oct 15, 2020

I will be adding this comment at the top of ShowExampleAppDockSpace():

// In 99% case you should be able to just call DockSpaceOverViewport() and ignore all the code below!
// In this specific demo, we are not using DockSpaceOverViewport() because:
// - we allow the host window to be floating/moveable instead of filling the viewport (when opt_fullscreen == false)
// - we allow the host window to have padding (when opt_padding == true)
// - we have a local menu bar in the host window (vs. you could use BeginMainMenuBar() + DockSpaceOverViewport() in your code!)
// TL;DR; this demo is more complicated than what you would normally use.
// If we removed all the options we are showcasing, this demo would become:
//     void ShowExampleAppDockSpace()
//     {
//         ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
//     }

@leiradel
Copy link
Author

apologies for not reacting on this since you found `DockSpaceOverViewport().

No problem, I'm glad it's fixed.

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

No branches or pull requests

2 participants