New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved method used to filter KeyRelease in X11 #1230
Conversation
I quickly tested this, it seems to indeed fix the issue. @naezith, can you confirm it works as well on your system? |
@mantognini It's working exactly the same for me, Release & Press repeats after a new window. |
@naezith Strange.. I did check again in a Ubuntu VM (at work I'm under Mint), this PR fixed the issue. Did you make sure to remove the old binaries and do a clean build? |
|
Yes. |
There seems to be a second issue. My fix should solve the issue caused by multiple windows (tested on both manjaro and on ubuntu). However, even with a single window I sometimes get the Release & Press repeats (but only on my pc with ubuntu), just at a much slower rate (e.g. once every second instead of many events per second which happened with multiple windows before my fix). While debugging I noticed that the repeats stop entirely when there is a cout on top of the function. I added a short sleep now when a KeyRelease event occurs to allow some time for the KeyPress to arrive. Now all key pressed and released events always seem to occur like they should. @naezith Could you test this new version? |
I think sleep call should not be there no matter what. |
I agree with that. The behavior was a bit inconsistent on my ubuntu pc without that sleep call, but that commit was more for testing than to really be included in SFML. |
So what's the status of this? Is the first commit okay? Did you manage to find out why there are additional repeats? |
The first commit should solve the issue. I tested it on two computers and mantognini also confirmed that it worked. I have no idea why on my ubuntu pc there were additional repeats unrelated to the first issue (they were much less often and more irregular, so the distinction with the original issue was very clear). But considering they only happen on that pc and the repeats didn't always occur (e.g. plugging in a keyboard or creating a new window or doing some other things could cause the repeats to stop), I'd suggest to just forget about this ever happening until someone else ever faces a similar issue. I'll remove the second commit later today. |
6fffe8a
to
0fde0c0
Compare
@binary1248 mentioned that this isn't really a good fix. Can you elaborate on a better approach to fix this issue, @binary1248? |
I submitted an alternative patch in #1291. |
There's a better implementation by @binary1248 in #1291 |
This should fix #1223.
The event behind KeyRelease is now only retrieved from the same window. Because peeking did not work well, the event is instead removed from the queue and put back afterwards (unless the event is KeyPress and key repeating is disabled).