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

Dock/undock window only with window's tab item #6709

Closed
KennyProgrammer opened this issue Aug 12, 2023 · 8 comments
Closed

Dock/undock window only with window's tab item #6709

KennyProgrammer opened this issue Aug 12, 2023 · 8 comments
Labels

Comments

@KennyProgrammer
Copy link

Version: 1.88 WIP
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: Win32/GLFW + GL3/GL4, Win32 + DX11/DX10 (here it really doesn't matter its ImGui Core issue)
Compiler: vs2022 msvc
Operating System: windows 10

My Issue/Question:

As the picture below, I would like to know if it is possible in ImGui to somehow dock windows ONLY when the window button is clicked + move (where is its name), and on the rest of the tab bar just move it without showing that it can be docked?

image

Because for my project is not inconvenient, when I just want to move a free window and ImGui constantly suggests that I can move it to the nodes on the window. But if wanna really dock it, i just need to move window by pressing on it title bar.

PS: I've try search ImGuiDockingFlags but nothing i can find. I just don't wanna modifiy ImGui code itself, because i need update ImGui to 1.89.7 / 1.90 when is come out.

@ocornut
Copy link
Owner

ocornut commented Aug 12, 2023

By default if you hold Shift it disables docking, and there’s a Config option in the IO structure to swap that behavior and require Shift to Dock. Maybe that would solve your problem.

@KennyProgrammer
Copy link
Author

KennyProgrammer commented Aug 13, 2023

Yea this works but it not actually what i need. I need when i click on title bar button behave as docking enabling, but rest of title bar should behave as just moving. But as i can see when window is docked to something, it displayed with title bar button, but if window is float point (not-docking) is displayed just text, but when window is float point, but contains 2+ windows it also add this title bar button (to allow opportunity to undock). I.e not always window has this title bar button.

It not big of a issue but when i need just move window, it show this docking preview thing and in some places i cannot move window because it dock it with another when i dont need to.

Docking with Shift is pretty good idea, but for game engine when user launch it, it doesn't know that need press Shift to dock windows, and became pretty conflicted.

So maybe solution can be just check is mouse hovered title bar area and hover title bar text and then enable docking?

@ocornut ocornut changed the title Dock window only with window's title bar button Dock/undock window only with window's tab item Aug 30, 2023
@ocornut
Copy link
Owner

ocornut commented Aug 30, 2023

I need when i click on title bar button behave as docking enabling, but rest of title bar should behave as just moving.

Well unless there is a strong case for it, we cannot be maintaining too many variety of behaviors. It's lots of work, create bugs, and make applications less consistent.

it displayed with title bar button, but if window is float point (not-docking) is displayed just text

There's a io.ConfigDockingAlwaysTabBar = true flag to change this behavior.
It's not activate by default because adding a dock node with tab-bar creates regressions (no auto resize, sizing constraints, no collapsing).

not always window has this title bar button.

What you are calling "title bar button" is called a "Tab" by the way.

It not big of a issue but when i need just move window, it show this docking preview thing and in some places i cannot move window because it dock it with another when i dont need to.

You can press SHIFT to disable this.
Or enable the inverted behavior with io.ConfigDockingWithShift = true:

Docking with Shift is pretty good idea, but for game engine when user launch it, it doesn't know that need press Shift to dock windows, and became pretty conflicted.

I think when this option is enabled we could consider adding a tooltip to provide this information.

So maybe solution can be just check is mouse hovered title bar area and hover title bar text and then enable docking?

You cannot disable docking it will undock all windows from each others.

@ocornut
Copy link
Owner

ocornut commented Aug 30, 2023

By the way you can also move floating windows by clicking anywhere in empty space and this way they won't dock (unless you activated io.ConfigWindowsMoveFromTitleBarOnly = true).

ocornut added a commit that referenced this issue Aug 30, 2023
…y while moving a window displays an help tooltip to increase affordance. (#6709, #4643)

Hope this doesn't feel spammy?
@ocornut
Copy link
Owner

ocornut commented Aug 30, 2023

when user launch it, it doesn't know that need press Shift to dock windows, and became pretty conflicted.

I tentatively pushed a change to display an affordance tooltip when io.ConfigDockingWithShift = true:
300464a

Please let me know if that's helpful.

@KennyProgrammer
Copy link
Author

I'm sorry for the long absence, I forgot about this question completely. In general, I came to the decision to use io.ConfigDockingWithShift and added this configuration to the settings.

There's a io.ConfigDockingAlwaysTabBar = true flag to change this behavior.
It's not activate by default because adding a dock node with tab-bar creates regressions (no auto resize, sizing constraints, no collapsing).

Yea, i tried that, but in that case (how you said) no collapsing auto resize, etc. And some problems with moving windows right after undock (it just stops move and need to click again to continue moving). So thats not the option.

I tentatively pushed a change to display an affordance tooltip when io.ConfigDockingWithShift = true:
300464a

I check that, its pretty usefull. But im still on 1.88 (because to migrate i need to make sure that im not broke any ImGui features and also not broke engine specific features for ImGui), when migrate to latest 1.90.1 maybe revisit this issue.

But in the meantime io.ConfigDockingWithShift its pretty good idea, thanks!

@KennyProgrammer
Copy link
Author

I will leave this question open for now as we can always improve it.

@ocornut
Copy link
Owner

ocornut commented Dec 18, 2023

But in the meantime io.ConfigDockingWithShift its pretty good idea, thanks!

That's good enough for it.
I don't seem we can sanely support every options, we need some cross-app consistency and design intent for imgui apps.

Note that 1.90.0 changed undocking behavior so you cannot undock by clicking on the empty space of a dock node tab bar, so this also sort of invalidate your request, since there's only 1 type of undocking click zone (the tab) for single window and 1 type of undocking click zone (the collapse/window menu button) for whole node.

Please try to upgrade more frequently. 1.88 is 18 months old and I'm only supporting backward compatibility symbols for 24 months, so recommended update frequency is <12 months. I will keep doing everything I can to make updates easier.

@ocornut ocornut closed this as completed Dec 18, 2023
ocornut added a commit that referenced this issue Apr 15, 2024
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