The Trunk: Morphic-mt.1679.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.1679.mcz

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

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

Name: Morphic-mt.1679
Author: mt
Time: 3 September 2020, 1:31:22.442904 pm
UUID: 88c94469-c1c1-4781-8e75-6a59d3bd76ee
Ancestors: Morphic-LM.1678, Morphic-mt.1675

Merge commits.

=============== Diff against Morphic-LM.1678 ===============

Item was changed:
  ----- Method: DialogWindow>>createMessage: (in category 'initialization') -----
  createMessage: aString
 
  messageMorph := aString asText asMorph.
  messageMorph
  name: 'Message';
  readOnly: true;
  setProperty: #indicateKeyboardFocus toValue: #never;
+ handlesKeyboardOnlyOnFocus: true. "If user presses enter while only hovering the text, we want to process the stroke to close the dialog."
- setProperty: #needsClickToFocus toValue: true.
  self setMessageParameters.
  ^ messageMorph!

Item was changed:
  ----- Method: Morph>>handleKeyDown: (in category 'events-processing') -----
  handleKeyDown: anEvent
  "System level event handling."
+ anEvent wasHandled ifTrue: [^ self].
+ (self handlesKeyboard: anEvent) ifFalse: [^ self].
+ (anEvent hand keyboardFocus ~~ self
+ and: [self handlesKeyboardOnlyOnFocus])
+ ifTrue: [^ self].
+
- anEvent wasHandled ifTrue:[^self].
- (self handlesKeyboard: anEvent) ifFalse:[^self].
  anEvent wasHandled: true.
+ ^ self keyDown: anEvent!
- ^self keyDown: anEvent!

Item was changed:
  ----- Method: Morph>>handleKeyUp: (in category 'events-processing') -----
  handleKeyUp: anEvent
  "System level event handling."
+ anEvent wasHandled ifTrue: [^ self].
+ (self handlesKeyboard: anEvent) ifFalse: [^ self].
+ (anEvent hand keyboardFocus ~~ self
+ and: [self handlesKeyboardOnlyOnFocus])
+ ifTrue: [^ self].
+
- anEvent wasHandled ifTrue:[^self].
- (self handlesKeyboard: anEvent) ifFalse:[^self].
  anEvent wasHandled: true.
+ ^ self keyUp: anEvent!
- ^self keyUp: anEvent!

Item was changed:
  ----- Method: Morph>>handleKeystroke: (in category 'events-processing') -----
  handleKeystroke: anEvent
  "System level event handling. Has support for automatically grabbing the keyboard focus considering the keyboard focus delegate. See #newKeyboardFocus:"
 
  | handler |
  anEvent wasHandled ifTrue: [^ self].
  (self handlesKeyboard: anEvent) ifFalse: [^ self].
+ (anEvent hand keyboardFocus ~~ self
+ and: [self handlesKeyboardOnlyOnFocus])
+ ifTrue: [^ self].
 
  handler := self wantsKeyboardFocus
  ifFalse: [self]
  ifTrue: [(anEvent hand newKeyboardFocus: self) ifNil: [self]].
  anEvent handler: handler.
 
  anEvent wasHandled: true.
  ^ handler keyStroke: anEvent!

Item was added:
+ ----- Method: Morph>>handlesKeyboardOnlyOnFocus (in category 'event handling') -----
+ handlesKeyboardOnlyOnFocus
+ "If set, reject every keyboard event until the receiver has received the keyboard focus in another way, i.e. a mouse click (see #mouseDown:) or programmatic focusing (see HandMorph >> #newKeyboardFocus:). This allows sending keyboard events to any owner of the receiver while the receiver is hovered by the hand. See senders.
+ A particular user is DialogWindow which looks for Enter and Escape presses and should not loose these events to the content morph unless it is explicitly focused. For the full discussion, see http://forum.world.st/The-Inbox-Morphic-cbc-1665-mcz-td5117905.html."
+
+ ^ self valueOfProperty: #handlesKeyboardOnlyOnFocus ifAbsent: [false]!

Item was added:
+ ----- Method: Morph>>handlesKeyboardOnlyOnFocus: (in category 'event handling') -----
+ handlesKeyboardOnlyOnFocus: aBoolean
+
+ ^ self setProperty: #handlesKeyboardOnlyOnFocus toValue: aBoolean!

Item was changed:
  ----- Method: PluggableTextMorph>>mouseEnter: (in category 'event handling') -----
  mouseEnter: event
  "Restore the selection in the text morph if there was a selection."
 
  super mouseEnter: event.
 
  selectionInterval ifNotNil: [:interval |
  textMorph editor
  selectInterval: selectionInterval;
  setEmphasisHere].
 
  Preferences mouseOverForKeyboardFocus
+ ifTrue: [event hand newKeyboardFocus: self].!
- ifTrue:[event hand newKeyboardFocus: self]!

Item was changed:
  ----- Method: TextMorph>>handleKeystroke: (in category 'events-processing') -----
  handleKeystroke: anEvent
  "Overwritten to support tab-among-fields preference."
 
  | pasteUp |
  anEvent wasHandled ifTrue:[^self].
  (self handlesKeyboard: anEvent) ifFalse: [^ self].
+ (anEvent hand keyboardFocus ~~ self
+ and: [self handlesKeyboardOnlyOnFocus])
+ ifTrue: [^ self].
 
  anEvent keyCharacter = Character tab ifTrue: [
  "Allow passing through text morph inside pasteups"
  (self wouldAcceptKeyboardFocusUponTab
  and: [(pasteUp := self pasteUpMorphHandlingTabAmongFields) notNil])
  ifTrue: [
  anEvent wasHandled: true.
  ^ pasteUp tabHitWithEvent: anEvent]].
 
  ^ super handleKeystroke: anEvent!

Item was changed:
  ----- Method: TextMorph>>handlesKeyboard: (in category 'event handling') -----
+ handlesKeyboard: evt
+ ^true!
- handlesKeyboard: anEvent
-
- ^ ((self valueOfProperty: #needsClickToFocus ifAbsent: [false]) ==> [
- anEvent hand keyboardFocus = self])!