[MCP] Morphic Event Dispatching

Ruedi Steinmann ruedisteinmann at gmx.net
Mon Feb 14 20:34:12 UTC 2005


Morphic Event Dispatching Design Proposal
------------------------------

We are now using MorphicEventDispatcher, a class with four (4) methods.
It was created to make Morph smaller. I think it blows the event
handling up and makes it more complicated. So, let's remove
MorphicEventDispatcher.

I'd like the following design:
HandMorph>>processEvents creates the MorphicEvents and sends them to
HandMorph>>dispatchEvent:. 

dispatchEvent does much the same as HandMorph>>handleEvent
(HandMorph>>handleEvent should be renamed to HandMorph>>dispatchEvent).
Then it passes the events to the World via Morph>>dispatchEvent: which
is:

dispatchEvent: evt
"Place to hook Morph specific event dispatching in"
"evt someTest ifTrue: [^ self morphSpecificEventDispatchMethod: evt]."
^self dispatchDefault: evt.

Morph>>dispatchDefault: is the same as
MorphicEventDispatcher>>dispatchDefault:with:

If some sort of event needs system wide special dispatching,
HandMorph>>dispatchEvent: should send
World(Morph)>>dispatchSomeFancyEvent: which uses
Submorph(Morph)>>dispatchSomeFancyEvent:. In the current implementation
the events are passed to Submorph(Morph)>>processEvent: which tests the
event again and passes it to dispatchSomeFancyEvent:. (inefficient)

I initially thought about making Morph>>dispatchEvent:evt the same as
MorphicEventDispatcher>>dispatchDefault:with: and let the morph specific
hooks be directly in dispatchEvent:, but then we'd have to change all
morph specific event dispatching methods if we would like to change
something in the default dispatching.

The current concept of dispatchMouseDown with these handlers should be
removed. Those handlers are not often used (afaik) and can be replaced
by morph specific event dispatching. ( read [MCP] Halo Handling if
you're interested) If you change MorphicEventDispatcher>>dispatchEvent:
not to send #dispatchDefault: instead of #dispatchMouseDown:, the UI is
still pretty operational.

Well, that's it for the moment.
Greets
Ruedi




More information about the Squeak-dev mailing list