[squeak-dev] Unix keyboard events lose track when multiple keys pressed or keys held down

tim Rowledge tim at rowledge.org
Sat Jan 16 23:17:06 UTC 2021

> On 2021-01-15, at 8:51 PM, tim Rowledge <tim at rowledge.org> wrote:
> Ah; look at static int x2sqKeyInput() {line 1720} - it carefully does some stuff to track the *single* last key pressed and if the event is a release, tells you what the last press key was and then sets the record of last-press to -1. Thus if we press a second key it destroys any evidence of the prior press and we're screwed.

So far as I can work out this insane collection of input X code is unable to convert a key release in the same way that it converts a key press; possibly sometihng to do with use of the extra compositor things and multiple keypresses ? We can't use XmbLookupString() since that is undefined for key release events.

What it means is that in order to provide an event saying "oh, key $b was released" based on the information provided by X events we had to use some side-effect algorithm that maps the char code produced by the last press of the key. Currently that only copes with a single key being pressed at a time. It seems faintly plausible that making a somewhat bigger array with pairs of the event keycode and the value returned last time that was pressed *might* work. The potential problem would be any case where a multiple key action had been required to compose a character; I have no idea how one might handle that.

I think this is one of those cases where simply passing the raw OS event data into the image and handling it there might have been less painful. Obviously more platform spread stuff in the image but...

Surely this can't be a unique situation?

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful random insult:- The wheel's spinning but the hamster's dead.

More information about the Squeak-dev mailing list