ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
59.73k stars 10.17k forks source link

The imgui window can't be moved outside the desktop region #3899

Open shi-yan opened 3 years ago

shi-yan commented 3 years ago

Version/Branch of Dear ImGui:

f1bf642e8f9b2a2ecbe03de10743bd1e504cb3f8

Version: 1.82 WIP Branch: docking

Back-end/Renderer/Compiler/OS Tried both opengl3 and vulkan/ sdl, gcc-8 ubuntu 18.04 on nvidia / xwindows

Back-ends: imgui_impl_sdl.cpp, vulkan / opengl3 Compiler: gcc-8 Operating System: ubuntu 18.04

My Issue/Question:

I'm testing the docking branch with the official examples. I have tried both the vulkan backend and the opengl3 backend. I have noticed some issues.

One problem is that once an imgui window is detached from the main window, it can't be moved outside the screen region.

This is inconvenient , because the window is very large and always occupies the desktop. Making it difficult to see what's behind. For certain use cases, I need to cross reference multiple application windows.

Screenshots/Video

Screenshot from 2021-03-11 09-56-04

Standalone, minimal, complete and verifiable example:

this is the same official demo, but it has a CMake file

testimgui.zip

tquante commented 3 years ago

I assume that you are using the x11 implementation of SDL.

Dear ImGui uses the set window position function of SDL to relocate the window. Unfortunately SDL as well as GLFW only communicate with xserver and not with the window manager. Therefore they are unable to move any window border beyond the screen border for some WMs. The main window uses the decoration to be relocated, which is handled by the WM, that has full control over the window position.

I do not have any experience with the wayland implementation.

shi-yan commented 3 years ago

yes, I'm on nvidia gpu, and can only use xwindows with ubuntu.

so which backend would support this function? I'm interested in using imgui to build conventional desktop applications.

shi-yan commented 3 years ago

when a panel is detached from the main window, are we creating a new window for it? I have seen other opensource projects trying to replicate the detachable tabs of the chrome browser, they would create another empty window, similar to the main window, and draw the detached ui there.

It seems that imgui's detachable ui is frameless and created differently.

shi-yan commented 3 years ago

I found this https://lazyfoo.net/tutorials/SDL/36_multiple_windows/index.php

not sure if useful

tquante commented 3 years ago

The undocked window is a separate window as well. The only difference is the missing decoration. As far as i know the Windows version of GLFW is working as intended. In principle you could alter the window creation in Dear ImGui which need to call the SDL create window function to reenable the window decoration, but i assume that this would break some invariants in Dear ImGui.

rokups commented 3 years ago

As i mentioned in another issue, this is a known bug which we reported to SDL and GLFW and are waiting for fixes. https://github.com/libsdl-org/SDL/issues/3813 https://github.com/glfw/glfw/issues/1817

rokups commented 3 years ago

Working on better handling this situation. Proof of concept patch linked above ☝🏻. It only works for GLFW as it properly reports window position when window is stuck at the edge of the screen. A PR submitted to SDL fixing a bug which will make SDL_GetWindowPosition() result reliable as well (https://github.com/libsdl-org/SDL/pull/4426). Once all pieces fall into places we will no longer have window/viewport position desync when window is stuck at the edge of the screen.

lucasjinreal commented 2 years ago

Does it supported put Imgui window outside of glfw window now?

hultsi commented 1 year ago

This still seems not to be fixed on X11 & GLFW. For a quick hack you can fork GLFW repo,