imgui icon indicating copy to clipboard operation
imgui copied to clipboard

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

Open chad171 opened this issue 2 years ago • 3 comments

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.

chad171 avatar Apr 19 '23 22:04 chad171

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.)

PathogenDavid avatar Apr 20 '23 05:04 PathogenDavid

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

chad171 avatar Apr 20 '23 19:04 chad171

Is the auto keyword allowed in the code base?

chad171 avatar Apr 20 '23 19:04 chad171