From 37dbb4ab12d0b7bfe826d1a5eb84d19fc1414507 Mon Sep 17 00:00:00 2001 From: Marcel Taeumel Date: Wed, 1 Nov 2023 16:15:22 +0100 Subject: [PATCH] Add w shortcut for window closing. Note that we must escape ! with !! here due to how .st file (chunk) parsing works. --- SwaImageConfiguration.st | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SwaImageConfiguration.st b/SwaImageConfiguration.st index ebc8b2b..08b87b9 100644 --- a/SwaImageConfiguration.st +++ b/SwaImageConfiguration.st @@ -167,7 +167,28 @@ Utilities setAuthorInitials: 'hpi'. "changed at end" "-=-=-=-=-=" "w shortcut to delete windows - experimental for SWA WiSe 23/24" +(Smalltalk at: #SystemWindow) compile: 'filterEvent: aKeyboardEvent for: anObject + "Provide keyboard shortcuts." + aKeyboardEvent isKeystroke + ifFalse: [^ aKeyboardEvent]. + aKeyboardEvent hand halo ifNotNil: [ : halo | halo target isSystemWindow ifTrue: [ aKeyboardEvent hand removeHalo ] ]. + + aKeyboardEvent commandKeyPressed ifTrue: [ + aKeyboardEvent keyCharacter caseOf: { + [$\] -> [self class sendTopWindowToBack]. + [Character escape] -> [self class deleteTopWindow]. + [$w] -> [self class deleteTopWindow]. + [$/] -> [self class bringWindowUnderHandToFront]. + } otherwise: [^ aKeyboardEvent "no hit"]. + ^ aKeyboardEvent ignore "hit!!"]. + + aKeyboardEvent controlKeyPressed ifTrue: [ + aKeyboardEvent keyCharacter caseOf: { + [Character escape] -> [self world findWindow: aKeyboardEvent]. + } otherwise: [^ aKeyboardEvent "no hit"]. + ^ aKeyboardEvent ignore "hit!!"]. + ^ aKeyboardEvent "no hit"'. "-=-=-=-=-=" "Remove Git Updates from PreferenceWizard as we use a special git version"