From 68ddca83e7ee5483574dbd83e8db2a3c3499b913 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 26 Mar 2022 19:50:01 +0800 Subject: [PATCH] ctlIME // +resetModifierFlags with application. --- Source/Modules/IMEModules/ctlInputMethod.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index 3f7e1861..fbb4d106 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -83,6 +83,15 @@ class ctlInputMethod: IMKInputController { IME.isFunction = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.function) } + func resetModifierFlags() { + IME.isShiftPressed = false + IME.isOptionPressed = false + IME.isCapsLockOn = false + IME.isCommandPressed = false + IME.isNumericPad = false + IME.isFunction = false + } + // MARK: - IMKInputController methods override init!(server: IMKServer!, delegate: Any!, client inputClient: Any!) { @@ -217,7 +226,8 @@ class ctlInputMethod: IMKInputController { } override func handle(_ event: NSEvent!, client: Any!) -> Bool { - // 更新全局共用狀態開關的參數。 + //重設且更新全局共用狀態開關的參數。 + resetModifierFlags() updateModifierFlags(event) if mgrPrefs.functionKeyboardLayout != mgrPrefs.basisKeyboardLayout {