[PATCH] Allows holding down two keys to repeat both ("Two-key repeat")
thomassross
thomasross at thomasross.io
Tue Mar 1 21:15:53 UTC 2016
From: Germain Bossu <germainbossu at yahoo.fr>
https://git.framasoft.org/bobo/xkb_repeat/blob/master/patches/xkb-repeat2-easy.patch
---
include/xkbsrv.h | 1 +
xkb/xkbAccessX.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index cc6307a..5d8d913 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -173,6 +173,7 @@ typedef struct _XkbSrvInfo {
KeyCode slowKey;
KeyCode slowKeyEnableKey;
KeyCode repeatKey;
+ KeyCode repeatKey2;
CARD8 krgTimerActive;
CARD8 beepType;
CARD8 beepCount;
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 02e820b..12ae964 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -80,6 +80,7 @@ AccessXInit(DeviceIntPtr keybd)
xkbi->inactiveKey = 0;
xkbi->slowKey = 0;
xkbi->repeatKey = 0;
+ xkbi->repeatKey2 = 0;
xkbi->krgTimerActive = _OFF_TIMER;
xkbi->beepType = _BEEP_NONE;
xkbi->beepCount = 0;
@@ -318,6 +319,8 @@ AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, void *arg)
return 0;
AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, TRUE);
+ if (xkbi->repeatKey2 != 0)
+ AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey2, TRUE);
return xkbi->desc->ctrls->repeat_interval;
}
@@ -326,7 +329,11 @@ void
AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi, KeyCode key)
{
if (xkbi->repeatKey == key)
+ {
xkbi->repeatKey = 0;
+ xkbi->repeatKey2 = 0;
+ }
+
return;
}
@@ -541,6 +548,10 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
DebugF("Starting software autorepeat...\n");
if (xkbi->repeatKey == key)
ignoreKeyEvent = TRUE;
+ else if (xkbi->repeatKey != 0)
+ xkbi->repeatKey2 = key;
+ else if (xkbi->repeatKey2 == key)
+ ignoreKeyEvent = TRUE;
else {
xkbi->repeatKey = key;
xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer,
@@ -644,6 +655,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
*/
if (xkbi->repeatKey == key) {
xkbi->repeatKey = 0;
+ xkbi->repeatKey2 = 0;
}
if ((ctrls->enabled_ctrls & XkbAccessXTimeoutMask) &&
--
2.7.0
More information about the xorg-devel
mailing list