If there is no significant risk to break anything and you have the time, why not.


Taeumel, Marcel via Squeak-dev <squeak-dev@lists.squeakfoundation.org> schrieb am Do., 16. Nov. 2023, 15:45:
Hi all --

This should be safe to port back to 6.0. You decide :-)

Best,
Marcel

Am 16.11.2023 15:21:01 schrieb commits@source.squeak.org <commits@source.squeak.org>:

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

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

Name: Morphic-mt.2140
Author: mt
Time: 16 November 2023, 3:20:33.050655 pm
UUID: ed3d0e30-60de-8642-9758-0ae4ca2d26a3
Ancestors: Morphic-ct.2139

Makes scrolling in nested scroll panes more comfortable. If an inner pane cannot scroll any further, propagate the event one level up so that an outer pane can scroll instead. Also works with scroll-by-keyboard.

=============== Diff against Morphic-ct.2139 ===============

Item was changed:
----- Method: ScrollPane>>filterEvent:for: (in category 'event filtering') -----
filterEvent: aKeyboardEvent for: morphOrNil
+ "See #initialize. This filter should be installed as keyboard event filter during the bubbling phase to support nested scroll panes from innermost to outermost, like the default #mouseWheel: support does because of normal event dispatching."
- "See #initialize. This filter should be installed as keyboard event filter during the capture phase."

(aKeyboardEvent isKeystroke
and: [self scrollByKeyboard: aKeyboardEvent])
ifTrue: [aKeyboardEvent ignore].

^ aKeyboardEvent!

Item was changed:
----- Method: ScrollPane>>handlesMouseWheel: (in category 'event handling') -----
handlesMouseWheel: evt
+
+ evt isWheelUp ifTrue: [^ scrollBar value > scrollBar minimumValue].
+ evt isWheelDown ifTrue: [^ scrollBar value < scrollBar maximumValue].
+ evt isWheelLeft ifTrue: [^ hScrollBar value > hScrollBar minimumValue].
+ evt isWheelRight ifTrue: [^ hScrollBar value < hScrollBar maximumValue].
+
+ ^ false!
- ^ true!

Item was changed:
----- Method: ScrollPane>>initialize (in category 'initialization') -----
initialize

"initialize the state of the receiver"
super initialize.
""
self initializePreferences.
hasFocus := false.
self initializeScrollBars.
""

self extent: self defaultExtent.
self updateMinimumExtent.

self setDefaultParameters.
+ self addKeyboardBubbleFilter: self.!
- self addKeyboardCaptureFilter: self.!

Item was changed:
----- Method: ScrollPane>>scrollByKeyboard: (in category 'event handling') -----
scrollByKeyboard: event
+ "Backwards compatibility. If event is ctrl+up/down then scroll and answer true. Use mouse-wheel events by default, see #mouseWheel:."
- "If event is ctrl+up/down then scroll and answer true. Backwards compatibility."

+ (event controlKeyPressed or: [event commandKeyPressed]) ifFalse: [^ false].
+
+ event keyCharacter = Character arrowUp ifTrue: [
+ ^ scrollBar value > scrollBar minimumValue
+ ifTrue: [scrollBar scrollUp: 3. true]
+ ifFalse: [false] ].
+ event keyCharacter = Character arrowDown ifTrue: [
+ ^ scrollBar value < scrollBar maximumValue
+ ifTrue: [scrollBar scrollDown: 3. true]
+ ifFalse: [false] ].
+ "
+ event keyCharacter = Character arrowRight ifTrue: [
+ ^ hScrollBar value > hScrollBar minimumValue
+ ifTrue [hScrollBar scrollDown: 3. true]
+ ifFalse: [false] ].
+ event keyCharacter = Character arrowLeft ifTrue: [
+ ^ hScrollBar value < hScrollBar maximumValue
+ ifTrue: [hScrollBar scrollUp: 3. true]
+ ifFalse: [false] ].
+ "
+
- (event controlKeyPressed or:[event commandKeyPressed "??? key decode table in event sensor does not change CTRL+up/down !!!!!!"]) ifFalse: [^ false].
- event keyCharacter = Character arrowUp
- ifTrue:
- [scrollBar scrollUp: 3.
- ^ true].
- event keyCharacter = Character arrowDown
- ifTrue:
- [scrollBar scrollDown: 3.
- ^ true].
- "event keyCharacter = Character arrowRight
- ifTrue:
- [hScrollBar scrollDown: 3.
- ^ true].
- event keyCharacter = Character arrowLeft
- ifTrue:
- [hScrollBar scrollUp: 3.
- ^ true]."
^ false!