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

input (wasm): buggy behaviour when losing focus during key press #1956

Open
eliasdaler opened this issue Jan 14, 2022 · 3 comments
Open

input (wasm): buggy behaviour when losing focus during key press #1956

eliasdaler opened this issue Jan 14, 2022 · 3 comments

Comments

@eliasdaler
Copy link
Contributor

eliasdaler commented Jan 14, 2022

Repro (I tested on Ubuntu 20.04 and Firefox and Chromium):

  1. Go to Keyboard example
  2. Hold any key
  3. While holding the key, click to another tab / window
  4. Release the key
  5. Go back to the example - you'll see that Ebiten thinks that the key is still pressed - the only way to "reset" it is to press the key again

This probably happens because Ebiten doesn't catch "key released" event when out of focus.

I think that Ebiten should poll all input on focus gain if it's possible (that's the only way for it to determine the current state of the keyboard if it lost some events).

@hajimehoshi
Copy link
Owner

Thanks! I don't think it is possible to poll such key inputs on browsers, but do you have any suggestions about implementation?

@eliasdaler
Copy link
Contributor Author

Ebiten stores the whole input state somewhere, right?
I think that it can "reset" every "key pressed" to false on focus gain, and set everything as if nothing is currently being pressed, unless it gets a new "key press" event.

@hajimehoshi
Copy link
Owner

I'm not sure this is so obvious, but let me investigate... Thanks!

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