[squeak-dev] The Trunk: Morphic-ct.1961.mcz
Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Apr 6 18:58:29 UTC 2022
> "preferredPosition isMorph" ... this is kind of a badly smelling piece of code there ;-)
+1. But I did not introduce it. ;-)
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Mittwoch, 6. April 2022 20:57:05
Betreff: Re: [squeak-dev] The Trunk: Morphic-ct.1961.mcz
"preferredPosition isMorph" ... this is kind of a badly smelling piece of code there ;-)
Am 06.04.2022 20:16:52 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Christoph Thiede uploaded a new version of Morphic to project The Trunk:
==================== Summary ====================
Time: 6 April 2022, 8:16:10.262385 pm
Tweaks default keyboard focus in dialog windows. Makes sure that for "fill in the blank" dialogs, users can type into the text field even it is not hovered initially. For system windows, avoid focusing a locked morph and beautifies the morph search by using a chained sort function.
=============== Diff against Morphic-ct.1960 ===============
Item was added:
+ ----- Method: DialogWindow>>defaultFocusMorph (in category 'accessing') -----
+ (preferredPosition isMorph and: [preferredPosition wantsKeyboardFocus]) ifTrue: [^ preferredPosition].
+ ^ nil!
Item was changed:
----- Method: DialogWindow>>getUserResponse (in category 'running') -----
| hand world |
self message ifEmpty: [messageMorph delete]. "Do not waste space."
self paneMorph submorphs
ifEmpty: ["Do not waste space and avoid strange button-row wraps."
self paneMorph delete.
self buttonRowMorph wrapDirection: #none].
hand := self currentHand.
world := self currentWorld.
self morphicLayerNumber: self class dialogLayer.
self openInWorld: world.
hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor."
hand keyboardFocus in: [:priorKeyboardFocus |
hand mouseFocus in: [:priorMouseFocus |
self exclusive ifTrue: [hand newMouseFocus: self].
+ hand newKeyboardFocus: self defaultFocusMorph.
- hand newKeyboardFocus: self.
[[self isInWorld] whileTrue: [world doOneSubCycle]]
ifCurtailed: [self cancelDialog].
hand newKeyboardFocus: priorKeyboardFocus.
self flag: #discuss. "Since 2016 we are having this *ping pong* between (a) restoring the prior mouse focus and (b) just clearing it globally. The former solution makes more sense while the latter fixes issues with some modal dialogs. We have to investigate this further."
"hand newMouseFocus: priorMouseFocus."]].
Item was added:
+ ----- Method: FillInTheBlankMorph>>defaultFocusMorph (in category 'accessing') -----
+ ^ self textPane!
Item was changed:
----- Method: SystemWindow>>defaultFocusMorph (in category 'focus') -----
| predicate |
predicate := (self hasProperty: #defaultFocusMorph)
+ ifFalse: [ [:morph | morph isLocked not and: [morph wantsKeyboardFocus]] ]
- ifFalse: [ [:morph | morph wantsKeyboardFocus] ]
ifTrue: [ | anObject |
anObject := (self valueOfProperty: #defaultFocusMorph) value.
anObject isMorph ifTrue: [^ anObject].
[:morph | morph knownName = anObject] ].
allMorphsBreadthFirstDo: [:morph | (predicate value: morph) ifTrue: [^ morph]]
+ sorted: #top ascending, #left ascending.
- sorted: [:a :b | a top < b top or: [a top = b top and: [a left <= b left]]].
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev