63b8d857c1d6 — Gerald Klix (speedy) 3 months ago
SUM: Fixed drag after menu item invocation bug.
1 files changed, 30 insertions(+), 12 deletions(-)

M haver/customizing/PreferencesMenu.pck.st
M haver/customizing/PreferencesMenu.pck.st +30 -12
@@ 1,6 1,6 @@ 
-'From Haver6.3 [latest update: #6169] on 26 January 2024 at 9:24:38 am'!
+'From Haver7.0 [latest update: #6454] on 25 June 2024 at 6:57:38 pm'!
 'Description I implement a bew perferences menu.'!
-!provides: 'PreferencesMenu' 1 43!
+!provides: 'PreferencesMenu' 1 44!
 !requires: 'PackageIntegrators' 1 11 nil!
 SystemOrganization addCategory: #PreferencesMenu!
 

          
@@ 222,6 222,19 @@ addConfigurationOptionsToMenu: aMenu
 			isEnabled: enableTaskbarItems ::
 			checkedBlock:  (checkBlockGenerator value: 4)! !
 
+!MenuItemMorph methodsFor: '*PreferencesMenu-private' stamp: 'KLG 6/25/2024 18:49:57'!
+actionBlockForEvent: anEvent
+
+	| selArgCount |
+	(selArgCount := selector numArgs) = 0
+		ifTrue: [
+			^ [ self invocationTarget perform: selector ]]
+		ifFalse: [ | messageArguments |
+			messageArguments := selArgCount = arguments size
+				ifTrue: [ arguments ] ifFalse: [ arguments copyWith: anEvent ].
+				
+			^ [ self invocationTarget perform: selector withArguments: messageArguments ]]! !
+
 !MenuItemMorph methodsFor: '*PreferencesMenu-drawing' stamp: 'KLG 7/8/2023 15:27:50'!
 drawOn: aCanvas 
 	| stringColor leftEdge magnifiedIcon |

          
@@ 260,22 273,17 @@ invocationTarget
 
 	^ target! !
 
-!MenuItemMorph methodsFor: '*PreferencesMenu-events' stamp: 'KLG 12/20/2022 23:20:35'!
+!MenuItemMorph methodsFor: '*PreferencesMenu-events' stamp: 'KLG 6/25/2024 18:51:04'!
 invokeWithEvent: evt
 	"Perform the action associated with the given menu item."
 
-	| selArgCount |
 	self isEnabled ifFalse: [^ self].
 	owner ifNotNil: [
-		owner deleteIfPopUp: evt ].
+		owner
+			subItem: self invokeWithEvent: evt;
+			deleteIfPopUp: evt ].
 	selector ifNil: [ ^ self ].
-	(selArgCount _ selector numArgs) = 0
-		ifTrue: [
-			self invocationTarget perform: selector]
-		ifFalse: [
-			selArgCount = arguments size
-				ifTrue: [ self invocationTarget perform: selector withArguments: arguments ]
-				ifFalse: [ self invocationTarget perform: selector withArguments: (arguments copyWith: evt)] ]! !
+	self actionBlockForEvent: evt :: value.! !
 
 !MenuItemMorph methodsFor: '*PreferencesMenu-layout' stamp: 'KLG 8/30/2021 14:01:17'!
 magnifiedIcon

          
@@ 427,6 435,16 @@ addSubSectionLine
 	Preferences at: #menusShowSubSectionTitles ::
 		ifTrue: [ self addLine ]! !
 
+!MenuMorph methodsFor: '*PreferencesMenu-events' stamp: 'KLG 6/25/2024 18:44:40'!
+subItem: aMenuItemMorph invokeWithEvent: anEvent
+	"A sub item was invoked. "
+
+	anEvent activeHand ifNotNil: [ :hand |
+		hand
+			newKeyboardFocus: prevKbdFocus;
+			newMouseFocus: nil ]
+! !
+
 !TheWorldMenu class methodsFor: '*PreferencesMenu-construction' stamp: 'KLG 8/9/2022 13:28:42'!
 clickGrabsMorphs
 	"Answer the menu item for click grabs morph"