On 5 November 2010 16:49, Stefan Marr <[email protected]> wrote:
> Hi:
>
>
> On 03 Nov 2010, at 23:59, Stefan Marr wrote:
>> Probably our VM is behaving slightly different from what the SqueakVM. (Not
>> sure what the 'right' thing to do is thought)
>>
>> From my understanding, the idea is that if there is no event, the primitive
>> will fail.
>> And all other images have that case covered. They set the first array index
>> to EventTypeNone.
>>
>> Thus, "InputEventFetcher>>primGetNextEvent: array" should look like:
>>
>> primGetNextEvent: array
>> "Store the next OS event available into the provided array.
>> Essential."
>> <primitive: 94>
>> array at: 1 put: EventTypeNone. "STEFAN: Added this line"
>> ^nil
>>
>> However, since Pharo works on the other VM, I guess the primitive there is
>> filling in the first slot of the array anyway.
>> So, what is the specification? I think the primitives have changed since
>> 'the bluebook'.
>
> Just to ask that question again: What is the conclusion, is the bug in the
> image or in the VM?
>
Here the Squeak implementation of it:
primGetNextEvent: array
"Store the next OS event available into the provided array.
Essential. If the VM is not event driven the ST code will fall
back to the old-style mechanism and use the state based
primitives instead."
| kbd buttons modifiers pos mapped |
<primitive: 94>
"Simulate the events"
array at: 1 put: EventTypeNone. "assume no more events"
"First check for keyboard"
kbd := super primKbdNext.
kbd = nil ifFalse:[
"simulate keyboard event"
array at: 1 put: EventTypeKeyboard. "evt type"
array at: 2 put: Time millisecondClockValue. "time stamp"
array at: 3 put: (kbd bitAnd: 255). "char code"
array at: 4 put: EventKeyChar. "key press/release"
array at: 5 put: (kbd bitShift: -8). "modifier keys"
^self].
"Then check for mouse"
buttons := super primMouseButtons.
pos := super primMousePt.
modifiers := buttons bitShift: -3.
buttons := buttons bitAnd: 7.
mapped := self mapButtons: buttons modifiers: modifiers.
(pos = mousePosition and:[(mapped bitOr: (modifiers bitShift: 3)) =
mouseButtons])
ifTrue:[^self].
array
at: 1 put: EventTypeMouse;
at: 2 put: Time millisecondClockValue;
at: 3 put: pos x;
at: 4 put: pos y;
at: 5 put: mapped;
at: 6 put: modifiers.
so, i assume that problem is in Pharo , which does not handling a
primitive failure correctly (by setting
array at: 1 put: EventTypeNone. )
> Thanks
> Stefan
>
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax: +32 2 629 3525
>
>
>
--
Best regards,
Igor Stasenko AKA sig.