Hello,
I'm trying to differentiate artificial vs physical keystrokes in X11 (as well as possible, I don't think 100% accuracy is possible), and I'm running into issues with key autorepeat. If I generate a synthetic key press then it starts auto-repeating, but if the user presses down the same key then I have no way to determine whether it's physical or just auto-repeat. X11 generates automatic key down-up events if a key is held, where the up event can be disabled with XkbSetDetectableAutoRepeat, but this requires the Display connection which libuiohook apparently doesn't expose. Another way would be to peek the next XEvent and see whether it's a key-up event for the same key and with the same timestamp, but this also can't be done without a Display connection. Any ideas?
Hello,
I'm trying to differentiate artificial vs physical keystrokes in X11 (as well as possible, I don't think 100% accuracy is possible), and I'm running into issues with key autorepeat. If I generate a synthetic key press then it starts auto-repeating, but if the user presses down the same key then I have no way to determine whether it's physical or just auto-repeat. X11 generates automatic key down-up events if a key is held, where the up event can be disabled with
XkbSetDetectableAutoRepeat, but this requires the Display connection which libuiohook apparently doesn't expose. Another way would be to peek the next XEvent and see whether it's a key-up event for the same key and with the same timestamp, but this also can't be done without a Display connection. Any ideas?