X11 Key held down leads to key pressed and released

1.8k Views Asked by At

How can I stop the KeyRelease event being spammed when I hold down a key on the keyboard?

I've searched the internet and found people suggesting putting a timer in the loop but I want a more efficient way.

Isn't there something in X11 that can turn the autorepeat off?

2

There are 2 best solutions below

0
On BEST ANSWER

I found the solution, I can use

XAutoRepeatOff(Display* display);
0
On

XAutoRepeatOff turns off auto-repeat for all applications.

To disable auto-repeat of KeyRelease events just for your application, use XkbSetDetectableAutorepeat as discussed in Ignore auto repeat in X11 applications.