godotengine / godot

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

Right clicking in the editor to open properties of a certain element instantly selects what's under cursor. #93265

Closed RadiantUwU closed 1 month ago

RadiantUwU commented 3 months ago

Tested versions

Not reproducible in v4.3.dev3.official [36e943b6b] Reproducible in v4.3.dev4.official [df78c0636] Reproducible in v4.3.dev5.official [c9c17d6ca] Reproducible in v4.3.dev6.official [64520fe67] Reproducible in v4.3.beta1.official [a4f2ea91a]

System information

Godot v4.3.beta1 - Arch Linux #1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 (nvidia; 550.78) - Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz (8 Threads)

Issue description

When you right click, it instantly selects something even though you didn't want it to select anything. To fix this, all you really need is to check if the mouse moved substantially from when the right click button was clicked to when the right click button is released.

Steps to reproduce

https://github.com/godotengine/godot/assets/69520693/1ea39699-4aeb-4591-baa6-3c093dc7cc14

Minimal reproduction project (MRP)

N/A

akien-mga commented 3 months ago

I can't reproduce the issue on 4.3.beta1 on Fedora 40 with KDE Plasma on Wayland (using X11 / Xwayland display driver).

I see you're also using KDE, are you on Wayland or X11 as session type, and are you using Godot's Wayland or X11 display driver?

Edit: I also tested on KDE Plasma X11 session, and still can't reproduce the bug.

RadiantUwU commented 3 months ago

Using Plasma X11 here, depends on how long you have it held, since it takes a while for it to pop up, and once it pops up, if you still have the button held it will just select anything under the cursor.

RadiantUwU commented 3 months ago

This could also be fixed by slightly offsetting the popup to the right

inhalt120g commented 3 months ago

I'm getting a similar behavior on MacOS, only in my case it's happening even on left button click: #92948

RadiantUwU commented 3 months ago

Godot 4.3-dev3: image Godot 4.3-beta1: image This still selects the button even though it's not in the box, which seems to be the primary issue.

RadiantUwU commented 3 months ago

I think this bug occurs somewhere around here https://github.com/godotengine/godot/blame/df78c0636d79c9545a283e0e2a926d623998cc27/scene/gui/popup_menu.cpp#L620

RadiantUwU commented 3 months ago

Regressed to 7884d632812996ef26184412846c533276cb4cc0

KoBeWi commented 3 months ago

How exactly #87462 caused the issue? Menus appearing right under cursor were already a thing, you can easily encounter them at the edges of the screen. The problem is that when you right-click something and it opens a menu, the menu should not be activated even if there is something under the cursor; there should be a timeout to prevent that.

Related #86952. Interestingly, the feature seems broken again on Windows .-.

RadiantUwU commented 3 months ago

Unsure how to be honest, but i went through every modification of the PopupMenu till i reached that, and that's when it started failing. Reverting it seemed to fix the issue.

akien-mga commented 3 months ago

CC @bruvzg

Quincy9000 commented 3 months ago

Happens in 4.3 beta 2 as well.

akien-mga commented 3 months ago

@Quincy9000 What distro, DE, and session type (X11/Wayland) are you using?

Still can't reproduce it myself on Fedora 40 with KDE Plasma 6.1.1, on either Wayland or X11 sessions.

Quincy9000 commented 3 months ago

@Quincy9000 What distro, DE, and session type (X11/Wayland) are you using?

Still can't reproduce it myself on Fedora 40 with KDE Plasma 6.1.1, on either Wayland or X11 sessions.

Windows 10, sorry. The issue seemed to go away after I alt tabbed into other apps and back.

KerekesDavid commented 2 months ago

Using Plasma X11 here, depends on how long you have it held, since it takes a while for it to pop up, and once it pops up, if you still have the button held it will just select anything under the cursor.

I can reproduce this on Ubuntu Wayland, 4.3 Beta 3. Very short right clicks don't seem to trigger it, sightly longer ones do. Especially noticeable when using two fingers on a touch-pad to right click.

akien-mga commented 2 months ago

So I'm still trying to find what's the common denominator between users who can reproduce this issue, as neither @bruvzg nor I can reproduce it on our Linux setups.

I see a couple reports of running into similar issues on macOS and Windows but I'm not sure they're actually the same issue. May be though, as it seems both X11 and Wayland users can reproduce it, which are two separate DisplayServer implementations, so it could also be reproducible in Windows and macOS.

That being said, we had a relatively low amount of reports for this issue so it seems to only affect a small subset of users.

I wonder if it's a HiDPI related issue. For affected users, could you give details on your screen resolution, system scaling factor, and the scaling factor set in the Godot settings?

and-rad commented 2 months ago

I'm facing the same problem. Specs incoming:

The problem never happens when I right-click using the physical button above the trackpad. When simulating right click with two-finger tapping, the problem happens pretty reliably when the context menu reaches the bounds of the parent scroll container. It happens almost never when the container is large enough to fit the entire context menu:

https://github.com/user-attachments/assets/bc06bac7-e615-49fb-9f8b-a33d533a34e0

geowarin commented 1 month ago

Same I have the problem 100% of the time on KDE wayland with a touchpad (Apple magic trackpad), when right clicking with a two fingers tap.

akien-mga commented 1 month ago

For those who can reproduce this issue, could you test #95232 and confirm it fixes it? (Howto)

geowarin commented 1 month ago

On a fresh master build (v4.3.rc.custom_build [33fe10c06]), I confirm that the issue is fixed for me! Thanks!