Phantom key presses


#1

Hello I’m using GLFW-3.2.1 on Ubuntu 18.10 in VirtualBox and Windows10 as host and I’m getting phantom key presses.
I tried polling the keys as well as using the callback.
I have seen there has been such a problem in the past with X11 but that should be fixed in in the current version.

When I press the key short I get one press and two release events:
press, release, release

When I press the key longer (once), I get one press event and when I release it gives several press and release events for even seconds:
press,… release, press, release, press … release

When I run Ubuntu 14 naively the problem is not that bad with the delayed key events, but still there are 2 release events.

Any ideas?


#2

This does indeed look like the issue:

Since you’re using GLFW-3.2.1 released on Aug 18, 2016, and this fix was committed on Mar 27, 2017 you won’t have the fix.

You would need to either use the master branch or wait for a new version to be released.


#3

The code I am using seems to be the latest github source because I saw the fix in it, but the behavior is like that nevertheless. Thanks anyways.


#4

If you have the latest from github and can repro the issue with the code in events.c:

Or a similar test case then it would be worth opening and issue on github.


#5

The event test runs fine no double events, not even in the Virtual Machine.
The comment on git says it happens when the rendering takes some time, like it does in my case.
I guess the event test can do the event polling faster or something.

When I take everything out of the main loop except the event polling I get, no matter how long I press, only this: PRESS, RELEASE, RELEASE (one release too much).

When I keep the rendering, I get the longer I press the more alternating PRESS, RELEASE times X I get (multiple presses despite it’s only one long).


#6

If you alter the event test to add a short wait before the polling can you manage to reproduce your issue?


#7

Yes I added a usleep(10000) no change, but usleep(50000) I got the same toggle after I released the key.
Happy cake day BTW.


#8

If you’re seeing this with the latest source code pulled from https://github.com/glfw/glfw (i.e. not a release but downloading the latest with git or the download button) then it would be worth posting this as an issue: https://github.com/glfw/glfw/issues