After upgrading from Ubuntu 8.10 to 9.04, i.e from Xorg server version 1.5.2 to 1.6.0, I started having problems with 'stuck keys'. I mean a key stuck in autorepeat mode as if the key was being pressed constantly, even if it was released normally. This happened randomly with different applications and different keys, but most often when entering VMWare remote consoles.
When I tried to set autorepeat off, I noticed that in fact the problem is triggered by the command
$ xset r off
When the command is typed (e.g. in a gnome-terminal or xterm) and Enter pressed, the Enter key starts repeating. A different variation is
$ read; xset r off
When this command is typed, Enter pressed and then Ctrl-D pressed (to terminate the read), the 'd' key starts repeating. However, if I do
$ sleep 1; xset r off
no key starts repeating. So it seems that when the autorepeat function is turned off, the last key pressed starts repeating if it was pressed within a sufficiently short interval before turning autorepeat off.
My normal autorepeat setting is delay 500, rate 30. When a key gets stuck and starts repeating, the way I can recover is to set a slow autorepeat rate, typcially I use 'xset r rate 500 3'. Then the next key press stops the repeating. Doing 'xset r off' does not help.
I reported this problem yesterday in Ubuntu's bug tracker under issue #124406, which has a long comment history of possibly related problems with stuck keys. See https://bugs.launchpad.net/ubuntu/jaunty/+source/linux/+bug/124406/comments/235 .
See also the discussion at:
xtrs (http://tim-mann.org/xtrs.html) is being victimized by this bug too. xtrs does not want X key repeat, so when the mouse enters the xtrs window, xtrs remembers the current state of key repeat and turns it off. It then restores the previous key repeat state when the mouse leaves the window or you exit from xtrs. I've gotten various keys to repeat infinitely when typing and moving the mouse in and out of the xtrs window.
I notice in the Ubuntu discussion that x11vnc and VMware Workstation are also affected, probably for the same reason -- they don't want X key repeat and thus turn it off automatically at certain times.
According to comment in ubuntu bug report : https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/367136
This problem is only reproducible with gnome-settings-daemon, therefore maybe not a Xorg issue. The upstream bug is there :
Can a Xorg developer confirm this?
It really is a xserver-xorg bug, as updating xorg from 1.5.2 to 1.6.0 in ubuntu intrepid makes the bug appear (under GNOME only with gnome-settings-demon enabled and with his a11y-keyboard plugin enabled)
The bug is gone in Ubuntu 10.04 alpha 2 with these packages :
Therefore it seems to be fixed.
i can reproduce the bug in F-11 (with server 1.6) but not in F-12 (server 1.7). XKB had a pretty massive cleanup between the two and finding the exact fix is tricky (bfb219f532f3c78ba905424365ee7c5f7b5f21a2 might be it though). Backporting the fix is probably quite time-consuming so unless someone volunteers to do so for the 1.6 branch, this one is unlikely to get fixed in 1.6.
I'm closing this bug as FIXED, since 1.7 and git don't suffer from this problem.