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

Buttons that miss mouse up events consume unrelated clicks afterwards #89917

Closed
paulmiller opened this issue Mar 26, 2024 · 0 comments · Fixed by #89926
Closed

Buttons that miss mouse up events consume unrelated clicks afterwards #89917

paulmiller opened this issue Mar 26, 2024 · 0 comments · Fixed by #89926

Comments

@paulmiller
Copy link

Tested versions

reproduced in 4.0.4.stable, 4.2.1.stable

System information

Godot v4.2.1.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Fri, 05 Jan 2024 16:20:41 +0000 - Tty - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (nvidia; 545.29.06) - Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 Threads)

Issue description

When a Button is clicked, it gets an InputEventMouseButton with pressed=true, then again with pressed=false when released. If the Button doesn't receive the 2nd event for any reason, then the next time the user clicks anywhere, the Button will activate again, even if it wasn't clicked.

A scenario where the Button would miss the mouse up event is:

  • The Button is in a SubViewport.
  • The parent Viewport is manually forwarding events to the SubViewport with push_event().
  • The Button is hooked up to hide the SubViewport, and prevent it from receiving further input. This can be done with set_process_input() and set_process_unhandled_input(), or with explicit logic in the parent to only forward events when the SubViewport is visible.

Steps to reproduce

  • Run the attached project.
  • Click "Hide Screen" to hide the billboard rendering the SubViewport.
  • Press [space] to bring the billboard back.
  • Click anywhere else. The Button activates again, even if it wasn't clicked the 2nd time.

Keep the game window focused the entire time. If it loses focus, it won't repro.

Minimal reproduction project (MRP)

subviewport-button-visibility-test.zip

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

Successfully merging a pull request may close this issue.

3 participants