[PATCH] Allows holding down two keys to repeat both ("Two-key repeat")

walter harms wharms at bfs.de
Tue Mar 1 08:39:41 UTC 2016



Am 29.02.2016 23:59, schrieb thomassross:
> 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 | 9 +++++++++
>  2 files changed, 10 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..e0a135c 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;
>  }
> @@ -327,6 +330,7 @@ AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi, KeyCode key)
>  {
>      if (xkbi->repeatKey == key)
>          xkbi->repeatKey = 0;
> +        xkbi->repeatKey2 = 0;
>      return;
>  }


this looks strange, either the indent is wrong or same braces are missing ?

      if (xkbi->repeatKey != key)
	return

      xkbi->repeatKey = 0;
      xkbi->repeatKey2 = 0;

below there is the same pattern, maybe you want to use AccessXCancelRepeatKey()
there ?

just my 2 cents,

re,
 wh

>  
> @@ -541,6 +545,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 +652,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
>       */
>      if (xkbi->repeatKey == key) {
>          xkbi->repeatKey = 0;
> +        xkbi->repeatKey2 = 0;
>      }
>  
>      if ((ctrls->enabled_ctrls & XkbAccessXTimeoutMask) &&


More information about the xorg-devel mailing list