[squeak-dev] Re: EventSensor questions
Andreas Raab
andreas.raab at gmx.de
Thu Feb 12 09:20:34 UTC 2009
Michael van der Gulik wrote:
> I'm seeing an inputSemaphore in the EventSensor class, but it doesn't
> appear to be used. Is it used anywhere? Considering that it doesn't
> appear to be used, how stable is the VM side of this code?
The input semaphore is used for two purposes: First, it tells the VM to
use the event based primitive set (contrary to the state-based set) and
second, it is signaled by the VM when a new event is recorded. I don't
think the latter information is currently being used but the former most
definitely is.
> How many platforms support this inputSemaphore? Does it work on Windows,
> Mac and Linux?
Yes. As far as I recall it is supported everywhere.
> Also, am I seeing this right: Morphic polls Sensor? The loop is in
> Project>>spawnNewProcess, which eventually calls
> HandMorph>>processEvents which reads from Sensor.
Correct. This is badly broken for many reasons. In Tweak, the hand holds
an event queue into which events are being pushed from the outside. This
is a much safer and more robust approach.
> Looking at the implementation of EventSensor and InputSensor, what
> is the actual history there? In terms of primitives, EventSensor (the
> "new" class) seems to be more consistent with chapter 29 of the blue
> book, while the InputSensor (the "old" class) uses
> undocumented primitives. How did it end up this way?
InputSensor was first. It used state-based primitive (i.e.,
primMouseButtons) and was used for a very long time. However, because of
its design, it resulted in events being lost (for example, when a mouse
down-up transition happens between two polls for input sensor state) so
I added the event based primitives. I have never cared much for the blue
book so if this is more consistent with chapter 29 it's purely by
accident (or perhaps because that's the more sensible way of doing
things ;-)
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|