Reading keyboard state

Hans-Martin Mosner hm.mosner at cityweb.de
Mon Dec 6 21:29:07 UTC 1999


Lex Spoon wrote:

> Bert Freudenberg <bert at isgnw.CS.Uni-Magdeburg.De> wrote:
> > On Fri, 3 Dec 1999, Henrik Gedenryd wrote:
> >
> > > AFAIK, there is no way to get the current keyboard state for the regular
> > > alphanumeric keys, like you can for modifier keys and mouse buttons.
> > >
> > > Is there any way to check whether eg. the key 'i' is pressed at the moment?
> >
> > Nope. Only key-press events are forwarded to Squeak, key-release events
> > are eaten by the VM.
> >
>
> If and when the low-level input system is looked at again, let's please
> look at this.  By far most smalltalk programs won't care, but games are
> a notable exception that might be worth thinking about.
>
> Lex

That's right, but supporting key-up events on all platforms is a porting
nightmare.
Some platforms simply don't provide them, or only provide some combinations and
not others, etc.
And you probably can't disable auto-repeat, or you get key-up events in the wrong
order for modifiers, or the shift state is wrong for key-up events, ...

If you look at the platform event handling code in some commercial multi-platform
Smalltalks (in the VM for VisualWorks, in the image for VisualAge) you see that it
consists mostly of workarounds for awkward and undocumented platform behavior :-(

If you have control over the real low level stuff (like writing the drivers for
mouse/keyboard), you can make it work quite nicely. But not if you're at the mercy
of M$ or Apple or whoever wrote that ugly non-Smalltalk OS you have to use to get
Squeak running.

Hans-Martin





More information about the Squeak-dev mailing list