diff options
author | Michael Stapelberg <stapelberg@google.com> | 2020-03-26 21:53:58 +0100 |
---|---|---|
committer | Michael Stapelberg <stapelberg@google.com> | 2020-04-10 16:38:17 +0200 |
commit | 4f95d87d66b6a6e11aa8616c9242e0907ffee66b (patch) | |
tree | 50f0f3e9bd1ed49deca940a962756ba9ca2545f1 | |
parent | 5684d436e2b65cd0fe305460e437a2f69af29865 (diff) |
Xorg: honor AutoRepeat option
This option was implemented before the drivers were split in ≈2006,
and e.g. XWin still supports it.
With this commit, Xorg regains support, so that the following configuration can
be used to set the repeat rate for all keyboard devices without having to modify
Xorg command-line flags or having to automate xset(1):
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "de"
Option "XkbVariant" "neo"
Option "AutoRepeat" "250 30"
EndSection
Signed-off-by: Michael Stapelberg <stapelberg@google.com>
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 07e52bcf7..3cc90c4e9 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -323,6 +323,33 @@ ApplyTransformationMatrix(DeviceIntPtr dev) PropModeReplace, 9, matrix, FALSE); } +static void +ApplyAutoRepeat(DeviceIntPtr dev) +{ + InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; + XkbSrvInfoPtr xkbi; + char *repeatStr; + long delay, rate; + + if (!dev->key) + return; + + xkbi = dev->key->xkbInfo; + + repeatStr = xf86SetStrOption(pInfo->options, "AutoRepeat", NULL); + if (!repeatStr) + return; + + if (sscanf(repeatStr, "%ld %ld", &delay, &rate) != 2) { + xf86Msg(X_ERROR, "\"%s\" is not a valid AutoRepeat value\n", repeatStr); + return; + } + + xf86Msg(X_CONFIG, "AutoRepeat: %ld %ld\n", delay, rate); + xkbi->desc->ctrls->repeat_delay = delay; + xkbi->desc->ctrls->repeat_interval = rate; +} + /*********************************************************************** * * xf86ProcessCommonOptions -- @@ -821,6 +848,7 @@ xf86InputDevicePostInit(DeviceIntPtr dev) { ApplyAccelerationSettings(dev); ApplyTransformationMatrix(dev); + ApplyAutoRepeat(dev); return Success; } |