Mantis - Squeak
Viewing Issue Advanced Details
7597 VM minor always 01-13-11 02:22 01-18-21 23:13
0007597: keyUp events reported incorrectly on SqueakVM
The standard VM reports keyUp events incorrectly if two keys are depressed. The keyUp event is reported for the most recently depressed key, not for the key that is actually being released. Works correctly on Cog, defect exists for standard VM on unix and Mac (not sure for Windows).
Reported on vm-dev list by Matthew Fulmer ( referenced in the mail posting is attached to this bug report):

Date: Wed, 12 Jan 2011 20:30:47 -0500
From: Matthew Fulmer <>
Subject: Re: [Vm-dev] Where are precompiled stack VMs or interpreter VMs?

On Wed, Jan 12, 2011 at 12:15:22PM -0500, David T. Lewis wrote:
> On Tue, Jan 11, 2011 at 12:45:14PM -0500, Matthew Fulmer wrote:
> >
> > - Keyboard Up events are incorrect when multiple keys are
> > pressed at once. The latest vm's on fail,
> > however, they are nearing a year old, and the cog VMs (all
> > newer) don't have this bug.
> I'm not familiar with the Keyboard Up event issue. Can you say
> how to reproduce this, preferably with a Squeak trunk image?
> Sorry if this was discussed before, but I don't recall it.
> I was not anticipating any further changes to the interpreter VM
> until after this round of "official" builds, but this one sounds
> like it may be important.

File in the attached changeset. (don't show keystroke events)

do: "HandMorph showEvents: true"

quickly, press A, press B, release A, release B.

you should see these flash by the top-left corner of the screen,
and on Cog, this is what you see:

    [keyDown 'a']
    [keyDown 'b']
    [keyUp 'a']
    [keyUp 'b']

on the official VMs, you instead see this:

    [keyDown 'a']
    [keyDown 'b']
    [keyUp 'b']

(you can of course use any two keyboard buttons)

It's an issue on mac and linux at least. Not sure about windows

Matthew Fulmer (a.k.a. Tapple)

[-- Attachment 0000003: --]
[-- Type: text/x-squeak-fileout, Encoding: quoted-printable, Size: 2.4K --]

[-- text/x-squeak-fileout is unsupported (use 'v' to view this part) --] [^] (2,259 bytes) 01-13-11 02:22

01-13-11 03:16   
the bug is present on the official linux VM
I think, but am not sure, it is present on the official mac VM
I don't know about the official window's VM

the bug is fixed on the Cog linux VM
the bug is fixed on the Cog windows VM
I don't know about the Cog mac VM

This bug is notably fixed on the old 3.8-era Croquet VMs (all platforms), which may explain why it is fixed on Cog
01-17-21 05:35   
It turns out that the issue was actually not fixed on Cog after all, it just looked that way because of differences in the shell scripts.

The reason that the key up events are being lost is that either the
LC_ALL or the LC_CTYPE environment variable is set. The reason that the standard VM showed the problem and Cog did not is that the run script for the interpreter VM sets LC_ALL to the current value of $LANG. The run script for Cog does not do this.

The X11 VM display module provides three variations of x2sqKey() functions,
only one of which will be active. The default is x2sqKeyPlain(), which works as
expected for key up events. The x2sqKeyInput() variant is activated if
LC_ALL or LC_CTYPE are defined in then environment, and this function has
the missing key up event problem. The third variant, x2sqKeyCompositionInput(),
is active when the VM is started with the -compositioninput command line option
(or SQUEAK_COMPOSITIONINPUT environment variable is set). This also seems
to have the missing key up event problem.
01-17-21 05:38   
See thread on squeak-dev list [^] for recent discussion of the problem.
01-18-21 23:11   
Fix submitted SVN and pull request to opensmalltalk-vm.

r3794 | lewis | 2021-01-18 17:44:19 -0500 (Mon, 18 Jan 2021) | 6 lines

Fix missing KeyRelease events when multiple keys are depressed.
Reference Mantis 0007597 [^]
Rather than keep a single lastKey to remember the last previously
pressed key value, maintain an array size 256 of last key pressed values
indexed by X11 KeyCode. Works for any number of simultaneous keys.
01-18-21 23:13   
Fixed in SVN and pull request submitted to opensmalltalk-org