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

PopupMenu does not highlight items on mouse over if a submenu is opened #70361

Open
Tetane opened this issue Dec 20, 2022 · 11 comments · May be fixed by #85583 or #88392
Open

PopupMenu does not highlight items on mouse over if a submenu is opened #70361

Tetane opened this issue Dec 20, 2022 · 11 comments · May be fixed by #85583 or #88392

Comments

@Tetane
Copy link
Contributor

Tetane commented Dec 20, 2022

Godot version

v4.0.beta.custom_build [2a04b18] (also present in the v4.0 official beta build)

System information

Windows 10

Issue description

PopupMenu does not highlight items on mouse over if a submenu is opened:
godot_popup_menu

For comparison, here is an example of a popup menu in vscode to show how it should behave (items are highlighted even if the submenu is opened):
vscode_popup_menu

Steps to reproduce

Open a PopupMenu and a submenu in the editor, and mouse over items in the popup_menu while the submenu is opened.

Minimal reproduction project

Any project.

@Tetane Tetane changed the title Popup_menu does not highlight items on mouse over if a submenu is opened PopupMenu does not highlight items on mouse over if a submenu is opened Dec 20, 2022
@Chaosus Chaosus added this to the 4.0 milestone Dec 20, 2022
@EricEzaM
Copy link
Contributor

EricEzaM commented Jan 8, 2023

I think what's happens is The viewport of the submenu gets window focus when it opens, so mouse move events are not received by the unfocused viewport (parent menu).

@Maran23
Copy link
Contributor

Maran23 commented Jan 13, 2023

I think what's happens is The viewport of the submenu gets window focus when it opens, so mouse move events are not received by the unfocused viewport (parent menu).

Can confirm this from my testing. Although the popup_menu gets mousevents, the InputEventMouseMotion coordinates are based on the submenu (e.g. x coordinate is negative), therefore the logic can not detect any mouse hover.

@MinusKube
Copy link
Contributor

MinusKube commented Jan 26, 2023

I think this bug occurs since this change (from #67903):

DisplayServer::WindowID receiving_window_id = _get_focused_window_or_popup();
if (receiving_window_id == INVALID_WINDOW_ID) {
receiving_window_id = window_id;
}
Ref<InputEventMouseMotion> mm;
mm.instantiate();
mm->set_window_id(receiving_window_id);

Is there a reason for calling the event on the focused window instead of window_id (the window for which WndProc was called)?

@akien-mga
Copy link
Member

CC @Sauermann @bruvzg

@Sauermann
Copy link
Contributor

Is there a reason for calling the event on the focused window instead of the window for which WndProc was called?

This change was necessary so that DisplayServerWindows and DisplayServerX11 behave in the same way.
Changing the event-receiver here, would make it necessary to adjust the behavior in X11 too.

@MinusKube
Copy link
Contributor

Does this bug occur with X11?

@Sauermann
Copy link
Contributor

I can't replicate this bug on X11 Xfce with v4.0.beta.custom_build [a43db5a]

@gitcatrat
Copy link

Was about to open an issue about this..

Godot is only running on my old-ish Windows 10 PC, haven't tried on any other device or OS.

Godot Engine v4.0.rc1.mono.official.8843d9ad3 - https://godotengine.org
Vulkan API 1.2.170 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon R9 200 Series

Can replicate it everywhere: on editor menus and in-game menus for both dev run and exported build.

Only happens when sub-menu is opened, if it stays closed, then everything is smooth, even submenu list item hover. So the focus seems like a plausible cause, a test to confirm focus: if submenu opens, then letter key search searches only submenu.

Setting the opening delay won't have any effect, as long as submenu opens then discussed bugs happens.

@gitcatrat
Copy link

Adding just in case it clears something up: setting menu.GuiEmbedSubwindows to true does get rid of the input lag issue.
A warning to anyone rushing to implement it as a fix: it's probably not what you want, submenu positioning changes.

@Tetane
Copy link
Contributor Author

Tetane commented Feb 11, 2023

I also had the issue with tooltips in a menu, it could be related to the original issue.
When the tooltip appears, it grabs the focus and only disappear if I click somewhere else.
menu_tooltip3

@akien-mga
Copy link
Member

Tested on Linux, KDE Wayland with current 4.3.dev (0246230).

I can reproduce the issue in single window mode with both Wayland and X11.
I don't reproduce the issue with X11 in multi-window mode (not supported to test on Wayland).

I see no change from #88392 on Linux. I assume #88392 might be fixing the Windows multi-window issue, and may not fix it for single-window on Windows either? @bruvzg

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