[PopupMenu] Fix submenu item not popping on mouse enter#110256
[PopupMenu] Fix submenu item not popping on mouse enter#110256Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
|
This |
88a0428 to
a251137
Compare
|
Doesn't seem to fix the issue godot.windows.editor.dev.x86_64_Kdv2xEbSfA.mp4 |
|
It can be fixed by storing the next submenu that should show and once the timer timeouts we show it here after we hide the previous submenu. void PopupMenu::_minimum_lifetime_timeout() {
close_allowed = true;
// If the mouse still isn't in this popup after timer expires, close.
if (!activated_by_keyboard && !get_visible_rect().has_point(get_mouse_position())) {
_close_pressed();
}
}Or by having smaller wait time for both timers, I have tried submenu_timer = memnew(Timer);
submenu_timer->set_wait_time(0.3);
submenu_timer->set_one_shot(true);
submenu_timer->connect("timeout", callable_mp(this, &PopupMenu::_submenu_timeout));
add_child(submenu_timer, false, INTERNAL_MODE_FRONT);
minimum_lifetime_timer = memnew(Timer);
minimum_lifetime_timer->set_wait_time(0.3);
minimum_lifetime_timer->set_one_shot(true);
minimum_lifetime_timer->connect("timeout", callable_mp(this, &PopupMenu::_minimum_lifetime_timeout));
add_child(minimum_lifetime_timer, false, INTERNAL_MODE_FRONT);
Edit: |
|
Also this may be related to why the popup menu didn't receive the motion event when the mouse entered. |
The whack-a-mole continues - thanks for finding that. If you set the submenu timer to 0.1 does it still act the same per @WhalesState? Is there a movement sequence you can replicate this on an Editor menu? I will set this up for myself and go back on the hunt.
I agree that 0.1 feels better - any reason we can't set the default to 0.1 instead of 0.3? |
I just tested with the MRP from the issue you linked 🙃
Yes. |
That's pretty funny! My notoriety must be in reinventing the wheel. I've been testing with a much fancier menu that doesn't exhibit the issues as obviously for an as yet unknown reason. |
Okay, go to project settings and disable
There seems to be an issue regarding incorrect determination of the mouse leaving the safe area. |
Yes, The issue is that the parent window only process one event while another window has focus, but when you disable embedding sub-windows they become just fake windows extending |
Also this issue is in both embedded and non-embedded windows so maybe you forgot to revert back the timer changes while testing or you test with the changes from this PR, i have tested with editor submenus in master and the issue also exists there by default and the editor is not embedding subwindows. Screencast.From.2025-09-20.23-54-36.mp4 |
|
Also check what happens here, the root window receives one mouse event when another window is focused but when you focus it no other window receives any input, the settings window is exclusive so the parent window shouldn't receive any input at all. Screencast.From.2025-09-20.23-45-59.mp4 |
The PR fixed the issue with non-embedded windows and the Editor, though I found a couple of bugs there that I'm taking care of. What I've got working now for embedded widows is to emit the What you demonstrated regarded no window receiving input, might certainly be related to the closed submenu blocking input to the parent menu, which is the source of the blocked submenu issue. This is a deeper problem with |
a251137 to
b51c6d2
Compare
b51c6d2 to
49b8f45
Compare
|
After a lot of frustration, I finally had to get rid of the The other major problem was the fixes for issues with embedded vs. non-embedded subwindows were completely different. The only way to get embedded subwindows to work was connecting When the mouse moves out of a submenu item, it's last relative motion state inside its menu item is preserved, and if it's moving into the lower right quadrant (or lower left if right-to-left layout), it will start the Finally, I reduced the default submenu delay time from |
49b8f45 to
fd98bf6
Compare
|
This push adds support for right-to-left layouts for the direction testing of mouse movements toward an open submenu. |
YeldhamDev
left a comment
There was a problem hiding this comment.
Seems like everything is in order. Fantastic work!
One final recommendation, however: I think this behavior of the cursor's arc deciding if the submenu stays open or not should be documented somewhere.
bruvzg
left a comment
There was a problem hiding this comment.
Seems to be working fine, I have not found any issues with it. Code looks good.
@YeldhamDev Are you thinking in the class doc? I suppose it could go with |
|
Yeah, that sounds like a good place. |
e77a391 to
a024388
Compare
|
This push includes all suggested changes. |
There was a problem hiding this comment.
When the mouse is in between two items with submenus, it can flicker:
System Info: Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 (NVIDIA; 32.0.15.8108) - Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 threads) - 15.82 GiB memory
Warning
Flickering
popupmenu_flicker.mp4
I could not get it to happen in single-window mode, its probably only multi-window mode. On master, trying this results in the submenu hiding.
|
I worked out a fix for this very pesky flickering issue, but ran into another |
37f30a4 to
86edf21
Compare
|
This push fixes the flickering issue and ensures proper function with I also fixed a tricky bug that intermittently caused a submenu to close unexpectedly while moving the mouse toward it. This was caused by an unpredictable delay between when a timer is started and when Everything seems to be functioning properly for both embedded and non-embedded windows, so give it a whirl. |
kitbdev
left a comment
There was a problem hiding this comment.
Flickering issue is fixed.
Looks good on both single-window mode and multi-window mode.
86edf21 to
70e6ac5
Compare
|
Final push. Also nabbed the last source of the occasional error message. |
|
Thanks! |
|
Yahoo! |
|
This PR broke popup menus on Windows in editor, Was this PR tested on Windows at all before merging?? ERR_FAIL_COND_MSG(submenu_popup->is_visible(), vformat("_activate_submenu should not be called on an open submenu - index: %d.", p_over)); |
|
The error message does not necessarily indicate any instability, but I'll see about tracking down what's happening. How are the popups working otherwise? Is there any sequence of movement that repeatably triggers the error message? |
Simply hovering on the popup menus in editor triggers the error, I cloned current upstream and built it without any changes. I'm on Windows 10 x64... Replacing back the error block with if (submenu_popup->is_visible()) {
return; // Already visible.
}Will fix it but I'm not sure if that's good. |
|
Are you using single-window mode or default? I can't replicate this on Win 10 at the moment, but since I believe it is being handled cleaning by the I also have a fix ready for error messages releated to global and native system menus. |
|
I managed to replicate it once (in multi window mode). Seems like rather random error. |
|
My best guess at the moment is there is a random and short delay between the submenu hiding and when |
|
Should be fixed by #112967 |
Fixes #77246, Fixes #102081 and Fixes #70361.
This PR fixes the issue where a submenu would not open on hover until the mouse was jiggled. It also adds an additional delay to close a submenu when the mouse is moving to the right and goes across another submenu item. This provides time to reach a long submenu without it being closed by touching another submenu item.
[Edit: The issue below went away after the push eliminating
minimum_lifetime_timer. See comments below regarding probable source of the issue.]There were several things confounding the issue, one of which is mysterious. In_activate_submenu()callingsubmenu_pum->popup()would intermittently fail, leaving the submenu invisible, even whensubmenu_pum->is_visible()shows as true. This is fixed by aprocess_frame, so I added a hack to do this, but I'm sure there is a better way. There should be a fix maybe inWindowthat would detect the incomplete rendering?Here's the line that can be improved: