LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: NateS on November 18, 2012, 07:15:09

Title: [FIXED] Control key incorrectly reported as up when mouse pressed
Post by: NateS on November 18, 2012, 07:15:09
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.
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: NateS on November 19, 2012, 11:11:51
This makes control + click to multi select in my app very annoying. :) Half the time the control is not considered pressed.
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: Grum on November 19, 2012, 11:47:09
Seems to have to do with: https://github.com/LWJGL/lwjgl/issues/1
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: kappa on November 19, 2012, 11:52:11
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.
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: Grum on November 19, 2012, 12:29:57
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
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: spasi on November 19, 2012, 13:03:08
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.
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: spasi on November 19, 2012, 17:21:45
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.
Title: Re: [BUG] Control key incorrectly reported as up when mouse pressed
Post by: spasi on November 20, 2012, 11:35:22
I committed the fix to SVN too, this build (http://www.newdawnsoftware.com/jenkins/view/LWJGL/job/LWJGL/1885/) includes it.
Title: Re: [FIXED] Control key incorrectly reported as up when mouse pressed
Post by: NateS on November 21, 2012, 08:26:10
Many thanks! When do you think the next point release will be? I'd like to update libgdx.
Title: Re: [FIXED] Control key incorrectly reported as up when mouse pressed
Post by: Matzon on November 21, 2012, 21:57:03
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.
Title: Re: [FIXED] Control key incorrectly reported as up when mouse pressed
Post by: NateS on November 23, 2012, 08:45:59
Verified fix in build #1888.  :)