medley
medley copied to clipboard
Just a question: maiko/src/initkbd.c
Just a question:
In src/initkbd.c on line 498 it is setting the keyboard type for XWINDOW
:
InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE; /* 10 */
however, both KB_SUN3
and MIN_KEYTYPE
are both == 3, so this is OR-ing into devconfig
zero, not 10.
In addition, the value of \SUN.TYPE3KEYBOARD
in medley's LLKEY is 0, so it should be 0.
The comments on the other similar assignments, likewise, look to be incorrect.
(Worse than code with no comments is code with wrong
comments!)
I recall from some meetings that it was mentioned that this code was trying to put the value 10 into a 3-bit field! It appears that's actually not the case.
#define MIN_KEYTYPE 3
#define KB_AS3000J (7 + MIN_KEYTYPE)
#define KB_RS6000 (8 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_DEC3100 (9 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_HP9000 (10 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_X (11 + MIN_KEYTYPE)
#define KB_DOS (12 + MIN_KEYTYPE)
#define KB_SDL (13 + MIN_KEYTYPE)
/* KB_SUN4 not defined in older OS versions */
#ifndef KB_SUN4
#define KB_SUN4 4
#endif
#ifndef KB_SUN2
/* These KB types nog defined outside Sun world,so define them here */
#define KB_SUN2 2
#define KB_SUN3 3
#endif /* KB_SUN2 */
/* For the JLE keyboard */
#define KB_JLE 5
The /* 10 */ comment is bogus, for sure. Looking back at the original code when it was first checked in to git, it has the same comments, but in each case anything that would be over 7 is set to KB_SUN3 - MIN_KEYTYPE.
So it's not actually trying to store a value that's too big, but it ran out of bits to distinguish between the keyboards some time ago - so as it stands, Lisp doesn't know the difference between SUN3 and anything from RS6000 on up, including X and SDL.