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

Backends: GLFW: Support for viewport parenting (Windows only) #6352

Open
wants to merge 8 commits into
base: docking
Choose a base branch
from

Conversation

chad171
Copy link

@chad171 chad171 commented Apr 19, 2023

Version/Branch of Dear ImGui:

Version: 1.89.6 WIP
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp
Compiler: visual studio
Operating System: windows

My Issue/Question:

There is a limitation with glfw that creates some issues when using imgui with that backend on windows. If the user has ConfigViewportsNoTaskBarIcon enabled then detached imgui windows can get hidden behind other application windows, with no easy way to bring them back to the foreground. To see the issue just compile the glfw example on windows with ConfigViewportsNoTaskBarIcon=true.

My Solution:

You can set the GWLP_HWNDPARENT after the window has been created to get the same behavior that is offered in the windows imgui backend. Right now I've set it to only do this when NoTaskBarIcon is enabled, however the windows example backend always sets the parent.

@PathogenDavid
Copy link
Contributor

A few things:

  1. Instead of always setting the main viewport as the parent, this should honor ParentViewportID (see imgui_impl_win32 as an example.)
  2. The disclaimer about ParentViewportID at the top of the file should be reworded something along the lines of "has no effect on platforms other than Win32"
  3. Your PR should target the docking branch instead of master. (Click the Edit button towards the top of the page and change the base branch using the dropdown.)
@ocornut ocornut changed the base branch from master to docking April 20, 2023 08:42
updated comments in regards to windows support
@chad171
Copy link
Author

chad171 commented Apr 20, 2023

Thanks for the feedback, I've changed the code to use ParentViewportID.

@chad171
Copy link
Author

chad171 commented Apr 20, 2023

Is the auto keyword allowed in the code base?

@ocornut ocornut changed the title Hidden tool windows glfw backend when ConfigViewportsNoTaskBarIcon is true Jul 3, 2023
@ocornut ocornut changed the title Bckends: GLFW: Support for viewport parenting (Windows only)Hidden tool windows glfw backend when ConfigViewportsNoTaskBarIcon is true Jul 3, 2023
@ocornut ocornut changed the title Bckends: GLFW: Support for viewport parenting (Windows only) Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment