# HG changeset patch # User sr # Date 1530627468 -7200 # Node ID 9ddbf1c9d178ffc5759a8a352d3ce6ec40f470f4 # Parent 6dffe5499f3b8b6acbac604ab8e7707dcb1ba195 #TUNING by sr cache unusedShortCuts to get rid of the input delay from nested menu panels ans sub views class: KeyboardProcessor class definition changed: #processEvent:forModalView: diff -r 6dffe5499f3b -r 9ddbf1c9d178 KeyboardProcessor.st --- a/KeyboardProcessor.st Fri Jun 29 17:59:59 2018 +0200 +++ b/KeyboardProcessor.st Tue Jul 03 16:17:48 2018 +0200 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + " COPYRIGHT (c) 1997 by eXept Software AG All Rights Reserved @@ -16,7 +18,8 @@ Object subclass:#KeyboardProcessor instanceVariableNames:'returnIsOKInDialog escapeIsCancelInDialog menuBar autoAcceptListeners globalAccelerators componentWithInitialFocus - altFunctionWasExecuted eventFilter returnAction cancelAction' + altFunctionWasExecuted eventFilter returnAction cancelAction + unusedShortCutsCache' classVariableNames:'' poolDictionaries:'' category:'Interface-Framework' @@ -234,7 +237,7 @@ - |key rawKey topView wg app view action explicitFocusView focusView| + |key rawKey topView wg app view action explicitFocusView focusView isUnusedShortCut| event isKeyEvent ifFalse:[ ^ false ]. @@ -364,9 +367,33 @@ (self class isKeyEventIgnoredAsShortcut:event) ifFalse:[ "/Transcript showCR:event rawKey. "/Transcript showCR:event key. - (wg processShortcut:event) ifTrue:[ - ^ true - ]. + + "sr: after discussion with cg, + we decided to cache shortcuts with no actions. + we also know about the fact that this will ignore short cuts + from dynamic menus/views (but we decided to dont care)" + isUnusedShortCut := false. + + (rawKey notNil + and:[unusedShortCutsCache notNil]) ifTrue:[ + (unusedShortCutsCache includesIdentical:rawKey asSymbol) ifTrue:[ + isUnusedShortCut := true. + ]. + ]. + + isUnusedShortCut ifFalse:[ + (wg processShortcut:event) ifTrue:[ + ^ true + ] ifFalse:[ + unusedShortCutsCache isNil ifTrue:[ + "sr: I dont care about sync here, + because in worst case some shortcuts are calculated (to be unused) twice" + unusedShortCutsCache := IdentitySet new. + ]. + + unusedShortCutsCache add:rawKey asSymbol + ]. + ]. ]. ]. "/ support ALT-F4 (close window) @@ -384,6 +411,7 @@ "Modified: / 18-07-2011 / 09:47:57 / cg" "Modified (comment): / 13-02-2017 / 20:26:23 / cg" + "Modified: / 03-07-2018 / 16:14:09 / sr" ! requestForWindowClose