Gdx.input.isKeyPressed(ANY_KEY) broken (Linux)
See original GitHub issueAfter dragging the application window, the Gdx.input.isKeyPressed()
method always returns false when Input.Keys.ANY_KEY
is passed as parameter.
Issue details
I’m not familiar with the libgdx codebase enough, but I think the pressedKeys
value stops being updated at a certain point for whatever reason. This is also a platform specfic issue. I tested the same program on Windows 7 and it works as expected.
Reproduction steps/code
SSCCE That demostrates the issue..
- Clone the repository linked above.
- Run the desktop launcher.
- Press left, right, up, down, and space keys to verify that the image moves.
- Drag the window either with your mouse or a key combination.
- Repeat step 3.
Expected behaviour: At step 5 the program behaves like in step 3 with key presses moving the image inside the application window.
Observed behaviour: At step 5, the program keeps running normally, but Gdx.input.isKeyPressed(Input.Keys.ANY_KEY)
always returns false even though input is still correctly processed.
Version of LibGDX and/or relevant dependencies
libgdx 1.9.8
Environment
OS: Linux Kernel: x86_64 Linux 4.14.15-1-ARCH WM: i3wm CPU: Intel Core i7-5600U @ 4x 3.2GHz GPU: Mesa DRI Intel® HD Graphics 5500 (Broadwell GT2)
Java implementation
openjdk version “1.8.0_162” OpenJDK Runtime Environment (build 1.8.0_162-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
Affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
[EDIT]
- Added java implementation information (15 April 2018)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
I think we can close this issue if the bug doesn’t happen with LWJGL 3. LWJGL 2 itself is no longer actively developed since 4 years ago, so legacy projects should consider migrating over to our LWJGL 3 backend anyway.
@nhatzHK thank you for your information about JVM version.
I may be wrong but my guess is that the (awt) window is losing focus after move event, and messing with input listeners, I have to take a deeper look to understand what is happening.