summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hlusiak <saschahlusiak@arcor.de>2008-02-19 22:49:51 +0100
committerSascha Hlusiak <saschahlusiak@arcor.de>2008-02-19 22:49:51 +0100
commit8ae4d17ca3fb9ec06b16df5c737cd9021453a020 (patch)
tree8c25d4f32bb8838f391347f0022194a24d1f0910
parent134ce2e493882ce411d17ea97ebb243a7d574144 (diff)
Let kernel autorepeat pass when set on default values
xorg-server won't generate soft autorepeat, when interval/delay are at default of 40/660 (see xkb/ddxCtrls.c: XkbDDXUsesSoftRepeat). When we hit the defaults, we let the kernel autorepeat pass, if we differ, we swallow them all and let the server figure out autorepeat in software.
-rw-r--r--src/evdev_key.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/evdev_key.c b/src/evdev_key.c
index 9fd7dbb..dcbe48e 100644
--- a/src/evdev_key.c
+++ b/src/evdev_key.c
@@ -533,8 +533,35 @@ EvdevKeyProcess (InputInfoPtr pInfo, struct input_event *ev)
{
int keycode = ev->code + MIN_KEYCODE;
- /* filter all repeat events */
- if (ev->value == 2) return;
+ /* filter repeat events for chording keys */
+ if (ev->value == 2) {
+ DeviceIntPtr device = pInfo->dev;
+ KeyClassRec *keyc = device->key;
+ KbdFeedbackClassRec *kbdfeed = device->kbdfeed;
+
+ /* See xkb/ddxCtrls.c: XkbDDXUsesSoftRepeat
+ Xorg-server will only generate soft autorepeats, when
+ inverval/delay are NOT set to the default values of 40/660.
+
+ We let the kernel autorepeat events pass, when we hit the
+ default value and the key is not a modifier. */
+ if (device->key &&
+ device->key->xkbInfo &&
+ device->key->xkbInfo->desc &&
+ device->key->xkbInfo->desc->ctrls)
+ {
+ if ((device->key->xkbInfo->desc->ctrls->repeat_interval != 40) ||
+ (device->key->xkbInfo->desc->ctrls->repeat_delay != 660))
+ return;
+ }
+
+ int num = keycode >> 3;
+ int bit = 1 << (keycode & 7);
+
+ if (keyc->modifierMap[keycode] ||
+ !(kbdfeed->ctrl.autoRepeats[num] & bit))
+ return;
+ }
xf86PostKeyboardEvent(pInfo->dev, keycode, ev->value);
}