godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.67k stars 20.11k forks source link

If Prefer native menu is enabled after displaying a popupmenu at least once, it displays in odd location #93622

Open L-the-forgettable opened 2 months ago

L-the-forgettable commented 2 months ago

Tested versions

System information

Windows 10 - v4.3.beta2.official [b75f0485b]

Issue description

After displaying a PopupMenu at least once, if the option "Prefer Native Menu" in it's property list is enabled, displaying the popup menu again will reveal it in an odd location Godot_v4 3-beta2_win64_6gsPbSoEfc

Steps to reproduce

  1. Create PopupMenu node
  2. Add an item or two to the item list
  3. trigger the PopupMenu
  4. Enable the "Prefer Native Menu" property in the node's property list
  5. Retrigger the PopupMenu

Minimal reproduction project (MRP)

bug-report.zip I've included this project in two other bug reports I've posted recently - If you're coming from/going to one of the other two this is a part of, rest assured you don't need to redownload the project for each report. They are the exact same file.

akien-mga commented 2 months ago

CC @bruvzg

bruvzg commented 2 months ago

Not sure what's the issue here, you are using .popup() method without position, so it will be shown at the last set position (position is in embedding viewport coordinates, so it's relative to window for non-native and relative to virtual desktop for native).

L-the-forgettable commented 2 months ago

I'll be honest I had no idea that was intentional- It just seemed like such behavior I thought it was a bug. If there isn't anything already, maybe adding something somewhere that explains this behavior would be nice instead?