Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
When two keys are pressed at the same time the second callback is delayed #1112
I'm testing this on Xubuntu 17.04 x86_64 and using GLFW from github master from about two months ago. I modified the key callback in the simple example application like this:
This is what see when I slam down I and L keys down at exact same time:
The first callback comes right away, but the second one comes after 500ms delay, at the same time when the repeat callback start coming.
I can't reproduce this on my laptop's own keyboard. It only happens on external USB keyboard. To rule out bad keyboard behavior I captured USB messages from the keyboard and it reports both key presses immediately as it should.
The interesting thing here is that the delayed input happens only when both key presses arrive in the same USB message.
Digging into source code, I found this in x11_window.c:
When the key presses arrive in the same USB message the key press events here have the same time stamp, so it seems likely that the other key event gets rejected by this "hack".
I tried changing the condition to
I understood that #747 should have only happened with very low polling rates. As I retested it in Ubuntu Budgie (like in #996), I saw the excess callbacks even with high (at least 30 fps) frame rates when running the simple -example.
Edit: That hack with <= condition actually still suppressed all but the last excess key events. The last "ghost" event came with exact same time stamp and now passed the condition.
Same problem here. I also detected other kind of events ignored, for example when releasing a key and pressing another one very quickly or simultaneously (not very easy to reproduce).
Commenting out XOpenIM, also worked for me.
My system is Ubuntu 16.04.3 LTS (Unity)