medley icon indicating copy to clipboard operation
medley copied to clipboard

maiko: X Windows keyboard maps too many bit values for Medley

Open MattHeffron opened this issue 1 year ago • 2 comments

Describe the bug A clear and concise description of what the bug is. In maiko/src/initkbd.c, make_X_keymap() creates an X keysym to LISP keyboard code lookup table. As I understand it, the values in this table represent the bit-index of the LISP keyboard code to use to pass the key state transition information from maiko to Medley. This bit table (in the iopage struct in maiko, corresponding to \IOPAGE in Medley) is 7 16-bit words (112 bits). However, make_X_keymap includes values greater than 112 (other than the ignore value: 255). Specifically, for my keyboard on Windows 11 WSL Ubuntu 22.04.3, the values 129-132 are in the table at indices 106, 104, 109, 107. When these table values are used to set/clear bits in the bit table, they will reference iopage into the dllsepimagecsb field of the struct. This occurs in maiko/src/keyevent.c, kb_trans(u_short keycode, u_short upflg). It checks for keycode values >= 80 and subtracts 16, but it doesn't have an upper bound check. I don't know what, if anything, the dllsepimagecsb field is used for, but those keys will never be seen as such on the LISP side.

Discovered by code inspection (to figure out how this all works), and DEBUG output.

Attached files DEBUG output from make_X_keymap: debug.txt Keyboard mapping table inverted & sorted: keyboard-mapping-table-inverted-sorted.txt Output of xmodmap -pk: keymap.txt

MattHeffron avatar Dec 18 '23 21:12 MattHeffron

it doesn't solve the problem but might mitigate the impact to have some visual indication of whether the caps lock is or isn't on, especially when typing into a case-sensitive readtable.

I could imagine a WHOLINE indication (top of screen) or to change the caret size or blink ratio (faster)?

masinter avatar Dec 20 '23 02:12 masinter

On 12/19/2023 9:30 PM, Larry Masinter wrote:

it doesn't solve the problem but might mitigate the impact to have some visual indication of whether the caps lock is or isn't on, especially when typing into a case-sensitive readtable.

Back in the day I wrote a lispusers program called LOCKTOGGLE to do just that.  It put up a 16x16 window that was either all black or all white, depending.  You could park it anywhere on the screen you liked.  I just looked for it though and sadly it seems to be gone.

            - Michele

Michele31415 avatar Dec 20 '23 17:12 Michele31415