Event implementation
Marcel Weiher
marcel at metaobject.com
Wed Nov 1 09:11:14 UTC 2000
Hi Andreas,
thanks for the feedback!
> On what platform?!
MacOS-X, my usual haunt.
[timestamp is milliseconds]
Good that was what I had.
> > as well as what types of events are expected.
>
> Whatever your OS gives you. Mouse down, mouse up, mouse move, key
down, key
> up [*], character.
Interesting. When I provided key-down + key-up events to Squeak,
keyboard input didn't work. It only works when I provide KeyChar
events (which I currently do on key-down). Also, just for
comparison, these are the events that are provided by MacOS-X/Cocoa:
-left/right button down/up/dragged (6 in all)
- the event has a clickCount field already filled in
-mouse-moved
-mouse-enter/mouse-leave
- for user-defined tracking rectangles
-key-down/key-up
- raw key-code
- characters (string of characters that's generated)
- characters ignoring modifiers except for shift
- a repeat-flag if this is the result of a repeat-action
- flags-changed
- any of the modified keys changed
- periodic
- you can set up timers that periodically post events
- other: app activated/deactivated, power-off, etc.
> [*] The exact semantics for what to report on key down/key up
haven't been
> figured out yet. My current take is to simply use the X11 key
definitions
How about Unicode? This is what MacOS-X currently uses, and it
surprisingly has codes for the various special keys.
> Yes. But remember that the button state includes more than just
the button
> pressed / released and it is expected that Squeak gets the full set of
> "current" buttons. If you know that your system will report a
single button
> release at a time, then you may cache the last button state. If
not you'll
> have to query for it or to figure it out from the event you get.
Single-button mouse... :-) Anyway, I'd be happy if it worked even
that far, but it doesn't seem to want to. My ioGetNextEvent() is
instrumented and duly reports the mouse-down/mouse-up events for an
unmodified click, as well as the flags it sets in the event structure
( RedButtonBit set, all clear).
But the clicks only sometimes cause the desired effect, for example
bringing up the world-menu in morphic is particularly tricky, but
there are also significant troubles and delays with any other
operations involving mouse-clicks. Mouse-moved and keyboard events
(as long as they are KeyChar) are fine.
[no status events] -> OK, that was just a sanity check!
One more thing, I just checked the Windows VM sources, and I don't
see the input-event semaphore actually being used except as a flag --
no signaling. I currently signal it whenever an event has arrived.
Marcel
More information about the Squeak-dev
mailing list
|