diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-11-27 13:24:08 +1100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-12-02 19:00:33 +1100 |
commit | 6867652c2c8ad563d5655302d94134592b10265b (patch) | |
tree | 08d4df058e7d74230edb6359d61529dff9c55798 /src/evdev.c | |
parent | Store device file's minor/major to avoid duplicate devices. (diff) | |
download | xf86-input-evdev-6867652c2c8ad563d5655302d94134592b10265b.tar.gz xf86-input-evdev-6867652c2c8ad563d5655302d94134592b10265b.tar.bz2 xf86-input-evdev-6867652c2c8ad563d5655302d94134592b10265b.zip |
Keyboard: Disable kernel autorepeat
We handle autorepeat in software due to per-key repeat and whatnot, so
disable the kernel's, which just interferes with ours.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/evdev.c b/src/evdev.c index 25325a3..c11bd3e 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1077,6 +1077,33 @@ EvdevInit(DeviceIntPtr device) return Success; } +/* We handle repeat per-key for ourselves in the server, so disable it + * in the kernel. If in is true, disable it: if out is true, restore + * it. */ +static void +EvdevSetKeyRepeat(InputInfoPtr pInfo, Bool in) +{ + EvdevPtr pEvdev = pInfo->private; + int zero_repeat[2] = { 0, 0 }; /* delay, rate */ + + if (!(pEvdev->flags & EVDEV_KEYBOARD_EVENTS)) + return; + + if (in) { + if (ioctl(pInfo->fd, EVIOCGREP, pEvdev->key_repeat) != 0) + return; + + if (ioctl(pInfo->fd, EVIOCSREP, zero_repeat) != 0) + xf86Msg(X_WARNING, "%s: Couldn't set key repeat (%s)\n", pInfo->name, + strerror(errno)); + } + else { + if (ioctl(pInfo->fd, EVIOCSREP, pEvdev->key_repeat) != 0) + xf86Msg(X_WARNING, "%s: Couldn't reset key repeat (%s)\n", + pInfo->name, strerror(errno)); + } +} + /** * Init all extras (wheel emulation, etc.) and grab the device. * @@ -1124,6 +1151,7 @@ EvdevOn(DeviceIntPtr device) xf86FlushInput(pInfo->fd); xf86AddEnabledDevice(pInfo); EvdevMBEmuOn(pInfo); + EvdevSetKeyRepeat(pInfo, TRUE); pEvdev->flags |= EVDEV_INITIALIZED; device->public.on = TRUE; } @@ -1162,6 +1190,7 @@ EvdevProc(DeviceIntPtr device, int what) pEvdev->min_maj = 0; if (pEvdev->flags & EVDEV_INITIALIZED) EvdevMBEmuFinalize(pInfo); + EvdevSetKeyRepeat(pInfo, FALSE); pEvdev->flags &= ~EVDEV_INITIALIZED; device->public.on = FALSE; if (pEvdev->reopen_timer) |