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

is_anything_pressed() returns false if a key was pressed while the window was unfocused #79516

Open
KoBeWi opened this issue Jul 15, 2023 · 1 comment

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Jul 15, 2023

Godot version

4.1

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

Here you can see d appearing in the LineEdit, while is_anything_pressed() returns false.

godot.windows.editor.dev.x86_64_UbQXqJSTRY.mp4

Magic?

(note that the bug is not directly related to is_anything_pressed() but to the underlying implementation that tracks pressed keys)

Steps to reproduce

  1. Add is_anything_pressed() check that runs continuously
  2. Unfocus the window
  3. Press and hold any key
  4. Focus the window
  5. The key is not detected

Minimal reproduction project

N/A

@Sauermann
Copy link
Contributor

Similar thing happens for mouse events: related to #33928
I believe that the solution for this would be to add platform-specific code to query the current state of mouse/keyboard/controller/... states on NOTIFICATION_APPLICATION_FOCUS_IN.

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

No branches or pull requests

2 participants