[squeak-dev] EventSensor>processEvent: has bogus code

Bert Freudenberg bert at freudenbergs.de
Sat Mar 2 11:22:11 UTC 2013


On 2013-03-02, at 00:54, tim Rowledge <tim at rowledge.org> wrote:

> I'm trawling around in the bowels of Scratch and spotted some ugly soreta-event code. I've checked a nice recent image and although the ugly is different it still seems to be there in spirit at least. Same basic code is in Cuis as well - EventSensor>processSensorEvent:
> 
> For a while now - about a decade I'd think - the VMs have *not* reported the use of the set interrupt key (which is *still* set to cmd-.  Mac style and not to a platform suited value except on RISC OS) as a keyboard event. Thus the clause in EventSensor>processEvent: where 
> "	type = EventTypeKeyboard
> 		ifTrue: [ "Check if the event is a user interrupt"
> 			((evt at: 4) = 0
> 				and: [((evt at: 3)
> 						bitOr: (((evt at: 5)
> 							bitAnd: 8)
> 							bitShift: 8))
> 							= interruptKey])
> 					ifTrue: ["interrupt key is meta - not reported as event"
> 							^ interruptSemaphore signal].
> 
> "
> does the testing is bogus. It even has a comment explaining why it is bogus.

The comment just says that *if* this gets reported as a keyboard event from the VM, it will *not* be passed on as an event from the Sensor, but *instead* signal the interruptSemaphore directly.

> Unless I'm missing things (it's Friday afternoon ok?) this clause really ought to be removed.

Why? It doesn't hurt anyone, even if no current VM sends these events.

> And really - we still have all those long obsolete io prims called in there too? Oh my. You can just about excuse the VMs having the code to support ancient images, but not modern images.

They shouldn't be called on a modern VM that supports events, true. But there are always new VM platforms, and implementing the polling on the VM side is certainly easier than the events, no?

- Bert -




More information about the Squeak-dev mailing list