You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 anInputEventMouseButton
withpressed=true
, then again withpressed=false
when released. If theButton
doesn't receive the 2nd event for any reason, then the next time the user clicks anywhere, theButton
will activate again, even if it wasn't clicked.A scenario where the
Button
would miss the mouse up event is:Button
is in aSubViewport
.Viewport
is manually forwarding events to theSubViewport
withpush_event()
.Button
is hooked up to hide theSubViewport
, and prevent it from receiving further input. This can be done withset_process_input()
andset_process_unhandled_input()
, or with explicit logic in the parent to only forward events when theSubViewport
is visible.Steps to reproduce
SubViewport
.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
The text was updated successfully, but these errors were encountered: