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

Nested menu closes when tooltip goes outside window (1.91.6-docking) #8252

Open
briaguya-ai opened this issue Dec 20, 2024 · 4 comments
Open

Comments

@briaguya-ai
Copy link

Version/Branch of Dear ImGui:

Version 1.91.6, Branch: docking

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

debian sid, gcc/g++ 14.2.0

Full config/build information:

Dear ImGui 1.91.7 WIP (19162)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201103
define: __linux__
define: __GNUC__=14
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl2
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000483
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

after hovering over an item in a nested menu that has a tooltip that goes outside the main window, moving the cursor anywhere else closes the nested menu

my repro example is based on the latest commit on the docking branch (as of writing), but i have encountered this issue in 1.91.6-docking and 1.90.6-docking (and a few earlier docking versions but i don't remember which)

i also think this has been reproduced outside of sdl/opengl with dxgi/dx11 but i can't confirm that

this is not an issue on the non-docking branch, the tooltip is just cut off in that case

Screenshots/Video:

Screencast.From.2024-12-19.20-07-48.mp4

Minimal, Complete and Verifiable Example code:

diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index ed205011..cf760d9b 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -8338,6 +8338,12 @@ static void ShowExampleMenuFile()
     if (ImGui::MenuItem("Open", "Ctrl+O")) {}
     if (ImGui::BeginMenu("Open Recent"))
     {
+        // BEGIN MENU CLOSE ISSUE
+        ImGui::MenuItem("HOVER OVER ME");
+        if (ImGui::IsItemHovered()) {
+            ImGui::SetTooltip("this is a really long tooltip that will overflow and go outside of the window space and hopefully reproduce the issue i was seeing before");
+        }
+        // END MENU CLOSE ISSUE
         ImGui::MenuItem("fish_hat.c");
         ImGui::MenuItem("fish_hat.inl");
         ImGui::MenuItem("fish_hat.h");
@ocornut
Copy link
Owner

ocornut commented Dec 20, 2024

What’s your SDL version?
What’s your window manager? Do you have a feature enabled to focus windows on hover?

@ocornut ocornut changed the title nested menu closes when tooltip goes outside window (1.91.6-docking) Nested menu closes when tooltip goes outside window (1.91.6-docking) Dec 20, 2024
@briaguya-ai
Copy link
Author

briaguya-ai commented Dec 20, 2024

What’s your SDL version?

2.30.10 (from debian sid repos)

libsdl2-2.0-0/unstable,now 2.30.10+dfsg-1 amd64 [installed,automatic]
  Simple DirectMedia Layer

libsdl2-dev/unstable,now 2.30.10+dfsg-1 amd64 [installed]
  Simple DirectMedia Layer development files

What’s your window manager?

GNOME Wayland

Do you have a feature enabled to focus windows on hover?

I don't think so, unless it is a default I'm not aware of.

I also want to emphasize that this is not a Linux/Wayland/GNOME specific issue, I know @Archez has encountered this on macOS and @Malkierian has encountered it on Windows

@PathogenDavid
Copy link
Contributor

FWIW, I cannot reproduce this on Windows. Do they see this issue with your specific repro?

@Malkierian
Copy link

I used to be able to reproduce on Windows, but I no longer can, on DX11 or OGL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants