-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
GLFW: hover doesn't work correctly with overlapping viewports #7316
Comments
(PS: No need to be posting 521 lines of code if the issue may be expressed in 6 lines (two Begin()/Button()/End() blocks) and pasted into an existing example app. It's easier to grasp and understand things when code is a minimal.) |
Hi, My version 3.3.9, when i set your backend flag, it works:
Thanks. |
Sorry, with more tests i see that now it is inverse: Screen.Recording.2024-02-14.at.08.07.08.mov |
Never set the backend flag manually, it needs to be set by the backend which can provide support for it. |
Q1: Yes, if i do it back to work. q1.movQ2: It was not set. ![]() Q3: 3.3.9
From: https://formulae.brew.sh/formula/glfw After update to 3.4.0 branch the problem of hover is solved but it is inverseted now, the click on window over the button make the button click happen, i made a new video: q3.movQ4: Video showing hover debug (it has 3.3.9 glfw): q4.mov |
Thank you for your careful answers. They are remaining issues on Mac and with GLFW. I'm going to ask for a little more, I think we can make progress on tthis. Q1: When the backend cannot provide Q2/Q3: With GLFW 3.3.9 we currently cannot support HasMouseHoveredViewport on Mac, but it should work with GLFW 3.4. Request: Can you try with GLFW 3.3.9 in imgui_impl_glfw,cpp to change: #if GLFW_HAS_MOUSE_PASSTHROUGH || (GLFW_HAS_WINDOW_HOVERED && defined(_WIN32))
io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can call io.AddMouseViewportEvent() with correct data (optional)
#endif to
And #if GLFW_HAS_MOUSE_PASSTHROUGH || (GLFW_HAS_WINDOW_HOVERED && defined(_WIN32))
const bool window_no_input = (viewport->Flags & ImGuiViewportFlags_NoInputs) != 0; to #if GLFW_HAS_MOUSE_PASSTHROUGH || GLFW_HAS_WINDOW_HOVERED
const bool window_no_input = (viewport->Flags & ImGuiViewportFlags_NoInputs) != 0; With this change (note that the requested changed from Q1 and Q2/Q3 are for two different code path, one is for fixing the logic without -- There is a remaining issue which you show in in q4.mov and q4-3.mov but I don't understand why it doesn't happen in q4-2.mov. I don't understand why this happen. Could you make that same video with GLFW 3.4 with the Metrics section open? |
Q1 - I change to 3.3.9 and the problem of hover still happen commenting that lines or not. q1-1.mov |
Q2: With the fixes, it works with 3.3.9 and all the problems appear be solved. q2-1.mov |
You need that i make a PR for this? |
No, I will investigate this further soon. There are two issues to fix but I cannot repro the 3.4.0 one with correct pass through, maybe its a mac only issue. |
If wanna help, im here. |
I'm getting access to Mac as I think they are variety of issues which are tricky to discuss. I pushed a first fix now for GLFW 3.3.x version, please check it out. But there's an additional issue with initial boot-time state. |
Version/Branch of Dear ImGui:
Branch: docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
macOS + clang
Full config/build information:
No response
Details:
Button hover don't work using viewports when one window is over other window:
When we create a window with a button (bt1) and a separate window with other controls, if the first window is over the second window, the hover over the button bt1 in window 1 don't work.
The hover and the click don't work.
See the video to see.
Screenshots/Video:
Screen.Recording.2024-02-14.at.04.57.21.mov
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: