[squeak-dev] The Trunk: Morphic-mt.1181.mcz
Chris Muller
asqueaker at gmail.com
Wed Jun 15 15:36:59 UTC 2016
Great! And if it is necessary to create a new Event to extend
attributes of an original Event, it could wrap it. I always felt
Event data should be basically immutable..
On Wed, Jun 15, 2016 at 4:20 AM, <commits at source.squeak.org> wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1181.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1181
> Author: mt
> Time: 15 June 2016, 11:20:40.050378 am
> UUID: 855f8338-73de-5947-9dc5-99e912d115a2
> Ancestors: Morphic-mt.1180
>
> ixes regression in event dispatching and coordinate transformations. Do not reset transformation in the event copy delivered to submorphs. They need those for, e.g., double click, drag-and-drop, etc.
>
> Our events do, more or less, not change after being created and initialized. The only exception is #wasHandled, #wasIgnored, and #position during event dispatching. Keep it that way. If you plan to change some event state in an event filter, create a new event instead and do not mess around with the current one.
>
> =============== Diff against Morphic-mt.1180 ===============
>
> Item was changed:
> ----- Method: MorphicEventDispatcher>>dispatchEvent:toSubmorphsOf: (in category 'private') -----
> dispatchEvent: anEvent toSubmorphsOf: aMorph
> + "Dispatch the given event to the submorphs of the given morph. For coordinate transformations, work only with copies. Either return the given event or a copy of any filtered event to employ immutability to some extent. --- PRIVATE!!"
> - "Dispatch the given event to the submorphs of the given morph. --- PRIVATE!!"
>
> + | localEvent filteredEvent |
> - | filteredEvent |
> aMorph submorphsDo: [:child |
> + localEvent := anEvent transformedBy: (child transformedFrom: aMorph).
> filteredEvent := child
> + processEvent: localEvent
> - processEvent: (anEvent transformedBy: (child transformedFrom: aMorph))
> using: self. "use same dispatcher"
> + filteredEvent == #rejected ifFalse: [ "some event or #rejected symbol"
> + self flag: #overlappingChildren. "mt: We cannot give two overlapping siblings the chance to handle the event!!"
> + filteredEvent == localEvent
> + ifTrue: [
> + localEvent wasHandled ifTrue: [anEvent copyHandlerState: localEvent].
> + anEvent wasIgnored: localEvent wasIgnored.
> + ^ anEvent]
> + ifFalse: [
> + filteredEvent := filteredEvent copy.
> + filteredEvent translateTo: anEvent position. "restore to untransformed coordinates"
> + filteredEvent wasHandled ifFalse: [filteredEvent copyHandlerState: anEvent]. "restore handler if needed"
> + ^ filteredEvent]]].
> - filteredEvent == #rejected ifFalse: [ "filteredEvent or #rejected"
> - filteredEvent translateTo: anEvent position. "restore to untransformed coordinates"
> - filteredEvent wasHandled ifFalse: [filteredEvent copyHandlerState: anEvent]. "restore handler if needed"
> - self flag: #overlappingChildren. "mt: We cannot give two overlapping siblings the chance to handle the event!!"
> - ^ filteredEvent]].
>
> ^ #rejected!
>
>
More information about the Squeak-dev
mailing list
|