It seems when using Display.setParent, if I hold control and press the mouse that control is momentarily reported as being up.
Executable example:
Canvas canvas = new Canvas();
JFrame frame = new JFrame("Test");
frame.add(canvas);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(new Dimension(640, 480));
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Display.setParent(canvas);
Display.setVSyncEnabled(true);
Display.create();
while (!Display.isCloseRequested()) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
Display.update();
if (!Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) //
System.out.println("control is up " + System.currentTimeMillis());
}
This occurs on Windows 7 64bit using LWJGL 2.8.5 and Java 1.7.0_02.
This makes control + click to multi select in my app very annoying. :) Half the time the control is not considered pressed.
Seems to have to do with: https://github.com/LWJGL/lwjgl/issues/1
Seems like a new issue introduced in LWJGL 2.8.5 as reports suggest that it works as normal on LWJGL 2.8.4, there were some changes made to the input handling on Windows (to allow keys to release when Display is not focused). Likely its related to that change.
Looking at: https://github.com/lwjgl/lwjgl/compare/lwjgl2.8.4...lwjgl2.8.5
The following seem likely candidates:
https://github.com/LWJGL/lwjgl/commit/9ffdd18a3fa00c13a4b399c945ea75417e78b885
https://github.com/LWJGL/lwjgl/commit/814f9a141ecbb5dedc53d7e9cd981e71eaa2b68a
The root cause is that we receive KILLFOCUS/SETFOCUS events whenever there's a mouse click. This only happens with Display.setParent, with the native window it's ok.
I managed to get rid of the redundant focus events, but the changes looked too risky. I've fixed this particular issue though. You'll have to build manually until the nightly builds are updated to use github.
I committed the fix to SVN too, this build (http://www.newdawnsoftware.com/jenkins/view/LWJGL/job/LWJGL/1885/) includes it.
Many thanks! When do you think the next point release will be? I'd like to update libgdx.
nightly builds need should probably run correctly from github. Endolf is on it, but its a bit problematic due to version conflict between the OS, github and git.
Verified fix in build #1888. :)