[PATCH] [xserver] xkb: Cancel a key's repetition when its autorepeat is disabled.
Dirk Wallenstein
halsmit at t-online.de
Fri Jan 21 03:45:47 PST 2011
On Fri, Jan 21, 2011 at 10:11:41AM +0200, Erkki Seppälä wrote:
> When XkbChangeEnabledControls is called to disable key repetition of a
> certain key (or keys), currently ongoing repetition of that key was
> not cancelled. It was cancelled if ChangeKeyboardControl was used to
> disable key repetition globally.
>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
> xkb/xkb.c | 12 +++++++++++-
> 1 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/xkb/xkb.c b/xkb/xkb.c
> index 7d95bc0..4a2590b 100644
> --- a/xkb/xkb.c
> +++ b/xkb/xkb.c
> @@ -915,9 +915,19 @@ ProcXkbSetControls(ClientPtr client)
> stuff->axtOptsMask);
> }
>
> - if (stuff->changeCtrls & XkbPerKeyRepeatMask)
> + if (stuff->changeCtrls & XkbPerKeyRepeatMask) {
> + unsigned key;
> +
> memcpy(new.per_key_repeat, stuff->perKeyRepeat,
> XkbPerKeyBitArraySize);
> + for (key = 0; key < 8 * XkbPerKeyBitArraySize; ++key) {
> + unsigned idx = key / 8;
> + unsigned bit = key % 8;
> + if (!(new.per_key_repeat[idx] & (1 << bit))) {
> + AccessXCancelRepeatKey(xkbi, key);
> + }
> + }
> + }
>
> old= *ctrl;
> *ctrl= new;
> --
> 1.7.0.4
>
It could be simplified a lot if you would use BitIsOn(). I would say
that the loop is not necessary -- just query and cancel xkbi->repeatKey.
--
Greetings,
Dirk
More information about the xorg-devel
mailing list