Open gabrieldevsouza opened 1 month ago
Sounds like the same underlying problem as:
Sounds like the same underlying problem as:
Yes, the issues seem related, but that one is more specific as it mentions the behavior with breakpoints. The steps provided here are easier to reproduce and likely to affect more users. I recommend keeping track of both bugs, and once one is fixed, checking if the other still occurs.
Thank you very much for your attention.
I'll keep this open but only because this is specific to mouse events, but otherwise it'd be the same issue and breakpoints matter little
Tested versions
Reproducible in 4.3-stable for Windows. "Godot Engine v4.3.stable.official.77dcf97d8"
System information
Windows 10 - Godot v4.3.stable - Compatibility (OpenGL API 3.3.0 NVIDIA 560.81 ) - Using Device: NVIDIA - NVIDIA GeForce RTX 3070
Issue description
When using
Input.is_mouse_button_pressed
to detect mouse clicks, the state does not update correctly if the user releases the mouse button after game window loses focus. Specifically, if the mouse button is pressed and the window loses focus (e.g., via ALT+TAB), and the button is then released while another window has focus,Input.is_mouse_button_pressed
continues to return true even after focus is returned to the game window.The expected behavior is for
Input.is_mouse_button_pressed
to return false once the mouse button is released, regardless of the window's focus. If the intended behavior is to avoid updatingis_mouse_button_pressed
while the window is not focused, it should at least update correctly when the window regains focus. However, I believe thatInput.is_mouse_button_pressed
should accurately reflect the state of the mouse button press, regardless of the game window's focus state.Recording of the bug reproduction in the video:
https://github.com/user-attachments/assets/2f37aa4e-fe6e-4363-8126-fcc9207b5b73
Steps to reproduce
Input.is_mouse_button_pressed
to detect mouse clicks.func _process(_delta: float) -> void: text = str("is_mouse_button_pressed: ", Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) print("is_mouse_button_pressed: ", Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT))