Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[HTML/GWT] Input.isKeyPressed Always TRUE If Release Occurs Outside of LibGDX Context #5134
Comments
villain-bryan
changed the title
Input.isKeyPressed Always TRUE If Release Occurs Outside of LibGDX Context [HTML5]
[HTML/GWT] Input.isKeyPressed Always TRUE If Release Occurs Outside of LibGDX Context
Mar 16, 2018
Tom-Ski
added
bug
gwt
good first issue
labels
Mar 27, 2018
allen-chin
added a commit
to allen-chin/libgdx
that referenced
this issue
Apr 5, 2018
This comment has been minimized.
This comment has been minimized.
smelc
commented
Apr 30, 2018
•
|
I'm affected on libgdx 1.9.6. It happens with chrome while it works fine with firefox. |
allen-chin
added a commit
to allen-chin/libgdx
that referenced
this issue
Jun 15, 2018
Tom-Ski
added a commit
that referenced
this issue
Jun 28, 2018
This comment has been minimized.
This comment has been minimized.
bardiharborow
commented
Jan 13, 2019
|
Fixed by #5167? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
villain-bryan commentedMar 16, 2018
Issue details
While in a LibGDX environment if you press down a key and then switch to any window outside of LibGDX's scope and release that key, the LibGDX environment does not detect that release event.
Upon re-entry to the LibGDX environment, there should probably be some re-polling evaluation of the keys LibGDX thinks are pressed keys to determine if they are still pressed or not.
It is worth noting that if you press down a key outside of the LibGDX environment and then go into the LibGDX environment, the keyDown is detected. So it appears to be just a bug on re-entry for keys that were pressed upon leaving the context since the release is happening outside of the environment.
Reproduction steps/code
If you ALT+TAB to a window outside of the browser, LibGDX thinks that ALT (and probably the TAB) is still pressed when you return to the LibGDX context. This really can make some keybinds feel sticky and broken.
This also makes for some very weird behavior with TextField (and probably heaps of other components). For the CONTROL_LEFT pressed down case, TextField CONTROL+A and CONTROL+Z offers specialized functionality, so if you press down CONTROL_LEFT, click another window (lose focus on the LibGDX browser), release CONTROL_LEFT, return to LibGDX context, Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT) will return true until you just press/release the bugged key in the LibGDX context.
DEMO: https://arenaofkings.com/demo/keydownbug.mp4
Relevant Code: https://hastebin.com/aqubejebuj.cpp
Version of LibGDX and/or relevant dependencies
1.9.8
Please select the affected platforms