The Trunk: Morphic-mt.1377.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1377.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1377.mcz

==================== Summary ====================

Name: Morphic-mt.1377
Author: mt
Time: 15 December 2017, 2:18:43.656611 pm
UUID: 9a7a0a92-9e24-b844-a5ab-d1f0e2ffa7af
Ancestors: Morphic-mt.1376

Fixes a bug in Morphic event dispatcher that affects focus events. For example, hiding a morph on #mouseDown: would render the environment unresponsive until something clears the mouse focus again.

=============== Diff against Morphic-mt.1376 ===============

Item was changed:
  ----- Method: MorphicEventDispatcher>>dispatchFocusEvent:with: (in category 'focus events') -----
  dispatchFocusEvent: anEventWithGlobalPosition with: focusMorph
  "Dispatch the given event to the given morph. Simulate capturing phase, handle the event, then do bubbling."
 
  | currentEvent |
  "1) Capturing phase."
  currentEvent := self doCapturingForFocusEvent: anEventWithGlobalPosition with: focusMorph.
+ currentEvent == #rejected ifTrue: [
+ "See implementors of #rejectsEvent:, which is usually based on receiver state and not event state. Thus, reset foci to avoid unresponsive environment."
+ anEventWithGlobalPosition hand
+ releaseKeyboardFocus: focusMorph;
+ releaseMouseFocus: focusMorph.
+ ^ #rejected].
+ "No need to reset foci here for ignored events because not all events might be ignored. Unlike #rejected."
- currentEvent == #rejected ifTrue: [^ #rejected].
  currentEvent wasIgnored ifTrue: [^ currentEvent].
 
  "2) No sub-tree processing here. Use #dispatchFocusEventFully:with: if you want that, too."
 
  "3) Let the focus morph handle the event."
  currentEvent := self doHandlingForFocusEvent: currentEvent with: focusMorph.
  currentEvent wasIgnored ifTrue: [^ currentEvent].
 
  "4) Bubbling phase"
  ^ self doBubblingForFocusEvent: currentEvent with: focusMorph!

Item was changed:
  ----- Method: MorphicEventDispatcher>>dispatchFocusEventFully:with: (in category 'focus events') -----
  dispatchFocusEventFully: anEventWithGlobalPosition with: focusMorph
  "Dispatch the given event to the given morph. Do capturing, processing in sub-tree, and bubbling."
 
  | currentEvent |
  "1) Capturing phase."
  currentEvent := self doCapturingForFocusEvent: anEventWithGlobalPosition with: focusMorph.
+ currentEvent == #rejected ifTrue: [
+ "See implementors of #rejectsEvent:, which is usually based on receiver state and not event state. Thus, reset foci to avoid unresponsive environment."
+ anEventWithGlobalPosition hand
+ releaseKeyboardFocus: focusMorph;
+ releaseMouseFocus: focusMorph.
+ ^ #rejected].
+ "No need to reset foci here for ignored events because not all events might be ignored. Unlike #rejected."
- currentEvent == #rejected ifTrue: [^ #rejected].
  currentEvent wasIgnored ifTrue: [^ currentEvent].
 
  "2) Sub-tree processing."
  currentEvent := self doProcessingForFocusEvent: currentEvent with: focusMorph.
  currentEvent wasIgnored ifTrue: [^ currentEvent].
 
  "3) Let the focus morph handle the event. Usually no effect because previous sub-tree processing involved the focus morph already -- at least in the bubbling phase. Skip it?"
  currentEvent := self doHandlingForFocusEvent: currentEvent with: focusMorph.
  currentEvent wasIgnored ifTrue: [^ currentEvent].
 
  "4) Bubbling phase."
  ^ self doBubblingForFocusEvent: currentEvent with: focusMorph!