Subject: Re: D'oh! (was DEC Multia/166 Video Shift)
To: The Terminator rAT <>
From: Chris G Demetriou <>
List: port-alpha
Date: 08/05/1996 03:13:43
> Now, another stupid question/observation :
> How come the only keys on my spiffo ALPS keyboard that auto-repeat under X
> are the damn Windows95(tm) flying windows keys?  I've used 'xev' to watch
> the events, and it's true.  I hold down the space bar, I get one event
> (KeyPress Space) when I push it down, and one (KeyRelease Space) when I
> release it. I hold down the SPIFFO Windows key, and I get KeyPress /
> KeyRelease messages as fast as the XTerm window can scroll.
> Weird -- I think it's the keyboard, though.  I assume the autorepeat 
> works on other machines, yeah?

Works great on the TC machines...  OH, WAIT, they don't have _any_
keyboard support...  8-)

No (and i thought this was documented someplace), key repeat on
machines with PC-style keyboards does not work.  Actually, that's not
entirely true; 'normal' key repeat does not work.  Because of a bogon
in the way i coded the keyboard driver, repetition of keys which use
the 'extended' keyboard code does happen.  I seem to recall that that
ends up being the keypad number keys (or some keys on the keypad), and
apparently your Windows Key, too.

The model was:

	'kbd' layer sits on top of real keyboard driver, and does
	key translation and key	repeat if the console is in 'tty'
	mode, else passes data on as 'events.'

	real keyboard driver passes single data items up to kbd
	layer from intr routine, which can either be placed into
	events or translated by a driver-provided routine into
	a string (representing that keystroke).

	real keyboard driver would disable all hardware key repeat.

	the 'kbd' layer would handle key repeat (with finely
	tunable parameters) for the console tty (by replaying
	the last keystroke string returned by the translation

	the X server would handle key repeat (however it wanted
	to) for X.

I spent a lot of time trying to disable hardware key repeat, only
to find out that it can't actually be done on PC keyboards.  The
implementation i ended up with basically didn't repeat multiples of
the same key code byte -- but that doesn't deal with the fact
that some keys, e.g. your windows key, use multi-byte codes.
That should be relatively easy to fix, i've just not done it yet.

I never wrote the support into the X server for doing the right thing.
The keyboard code in the X server is ... interesting.  Let's just say
"shortest path to running server."  8-)  I didn't and still don't
understand X server internals, so making X's internal key repeat
mechanism do the right thing is currently beyond me.  I was happy just
to make modifier keys work.  (you know, shift and control?  they took
about a half a day... 8-)

At some point, i got disgusted with the state of it all, and had many
other time demands dropped on my head, and so i've not touched it for
a while.  (I've still not actually convinced my employer that key
repeat is, in fact, a useful feature, or at least, useful enough that
I should be given the amount of time necessary to fix it, in the face
of other demands...)

So, in a nutshell, what you're seeing is the 'normal' behaviour,
abnormal as it is.