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

David T. Lewis lewis at mail.msen.com
Mon Jan 18 18:40:11 UTC 2021


Moving to vm-dev list for follow ups on the VM. Please keep the
Scratch related part of the discussion going here on squeak-dev.

On Mon, Jan 18, 2021 at 09:29:24AM -0500, David T. Lewis wrote:
> On Sun, Jan 17, 2021 at 03:58:00PM -0800, tim Rowledge wrote:
> > I *might* have a sensible solution that will work with LC_ALL defined.
> > 
> > The problem has been that in x2sqKeyInput we  use XmbLookupString which cannot work with a key release. In x2sqKeyPlain we use XLookupString which *does* work with a key release.
> > 
> > So my suggestion is to make use of x2sqKeyPlain within the x2sqKeyInput (and probably the x2sqKeyCompositionInput too?) key release. It seems to work ok in a shell where 
> > 
> > echo $LC_ALL
> > en_US.UTF-8
> > 
> > and the logging shows me that we are going through that route.
> > 
> > Attached the C file for comparison; note no change has been made to the x2sqKeyCompositionInput routine yet.
> > 
> > 
> > Does this seem a reasonable thing to do? 
> > 
> 
> I fear that it will not work for actual multibyte input though?
> 
> Key press events would be using the multibyte XmbLookupString
> routine and key release events would use single byte XLookupString.
> I have no expertise in this area but it does not sound right.
>

I think I found a clean way to handle the missing key up event problem.
I have it working in the interpreter VM now and I'll do a pull
request for opensmalltalk-vm either today or tomorrow. The commit
notice will look like this:

  Fix missing KeyRelease events when multiple keys are depressed.
  Reference Mantis 0007597 http://bugs.squeak.org/view.php?id=7597.
  Rather than keep a single lastKey to remember the last previously pressed
  pressed key value, maintain an array size 256 of last key pressed values
  indexed by X11 KeyCode. Works for any number of simultaneous keys.

It will work for Japanese keyboard with composition input also.

Dave


More information about the Squeak-dev mailing list