Open shi-yan opened 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.
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.
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.
I found this https://lazyfoo.net/tutorials/SDL/36_multiple_windows/index.php
not sure if useful
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.
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
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.
Does it supported put Imgui window outside of glfw window now?
This still seems not to be fixed on X11 & GLFW. For a quick hack you can fork GLFW repo,
void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos)
function from thereWrap XMoveWindow(...) and XFlush(...) in the following manner:
// Set override_redirect to true
XSetWindowAttributes wa = { 0 };
wa.override_redirect = True;
XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &wa);
XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos);
XFlush(_glfw.x11.display);
// Set override_redirect back to false as leaving it on would create other issues
wa.override_redirect = False;
XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &wa);
Not a solution I would create PR out of but it seems to work on X11 while we wait for the actual GLFW fix.
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
Standalone, minimal, complete and verifiable example:
this is the same official demo, but it has a CMake file
testimgui.zip