diff --git a/Source/Modules/SessionCtl_Core.swift b/Source/Modules/SessionCtl_Core.swift index fee52c18..f433f23f 100644 --- a/Source/Modules/SessionCtl_Core.swift +++ b/Source/Modules/SessionCtl_Core.swift @@ -43,6 +43,10 @@ public class SessionCtl: IMKInputController { /// 當前副本的客體是否是輸入法本體? public var isServingIMEItself: Bool = false + /// 用以存儲客體的 bundleIdentifier。 + /// 由於每次動態獲取都會耗時,所以這裡直接靜態記載之。 + public var clientBundleIdentifier: String = "" + // MARK: - /// 當前 Caps Lock 按鍵是否被摁下。 @@ -216,6 +220,7 @@ public extension SessionCtl { if let senderBundleID: String = (sender as? IMKTextInput)?.bundleIdentifier() { vCLog("activateServer(\(senderBundleID))") isServingIMEItself = Bundle.main.bundleIdentifier == senderBundleID + clientBundleIdentifier = senderBundleID } } DispatchQueue.main.async { diff --git a/Source/Modules/SessionCtl_Delegates.swift b/Source/Modules/SessionCtl_Delegates.swift index 51ede93c..ed63d513 100644 --- a/Source/Modules/SessionCtl_Delegates.swift +++ b/Source/Modules/SessionCtl_Delegates.swift @@ -11,11 +11,6 @@ import Shared // MARK: - InputHandler Delegate extension SessionCtl: InputHandlerDelegate { - public var clientBundleIdentifier: String { - guard let client = client() else { return "" } - return client.bundleIdentifier() ?? "" - } - public func candidateController() -> CtlCandidateProtocol? { candidateUI } public func candidateSelectionCalledByInputHandler(at index: Int) {