From ab8840aac6ce3366ae8ea8f968ecc7748f04545a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 14 Aug 2022 18:24:40 +0800 Subject: [PATCH] ctlIME // Sync recent changes to handleDelegateEvent(). --- .../ctlInputMethod_Delegates.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Delegates.swift b/Source/Modules/ControllerModules/ctlInputMethod_Delegates.swift index a105f42e..87ff91b9 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Delegates.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Delegates.swift @@ -60,9 +60,12 @@ extension ctlInputMethod: ctlCandidateDelegate { /// - Returns: 回「`true`」以將該案件已攔截處理的訊息傳遞給 IMK;回「`false`」則放行、不作處理。 func handleDelegateEvent(_ event: NSEvent!) -> Bool { // 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。 + let shouldUseHandle = + (IME.arrClientShiftHandlingExceptionList.contains(clientBundleIdentifier) + || mgrPrefs.shouldAlwaysUseShiftKeyAccommodation) if #available(macOS 10.15, *) { - if ShiftKeyUpChecker.check(event) { - if !rencentKeyHandledByKeyHandler { + if ShiftKeyUpChecker.check(event), !mgrPrefs.disableShiftTogglingAlphanumericalMode { + if !shouldUseHandle || (!rencentKeyHandledByKeyHandler && shouldUseHandle) { NotifierController.notify( message: String( format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", @@ -72,7 +75,9 @@ extension ctlInputMethod: ctlCandidateDelegate { ) ) } - rencentKeyHandledByKeyHandler = false + if shouldUseHandle { + rencentKeyHandledByKeyHandler = false + } return false } } @@ -103,7 +108,9 @@ extension ctlInputMethod: ctlCandidateDelegate { } errorCallback: { clsSFX.beep() } - rencentKeyHandledByKeyHandler = result + if shouldUseHandle { + rencentKeyHandledByKeyHandler = result + } return result }