From 3240ec1567e18a4f5655ffb841ab54c1b51ae630 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 4 Apr 2022 13:43:08 +0800 Subject: [PATCH] ctlIME // Move areWeUsingOurOwnPhraseEditor to IME module. --- Source/Modules/ControllerModules/KeyHandler.mm | 5 ++--- Source/Modules/IME.swift | 3 +++ Source/Modules/IMEModules/ctlInputMethod.swift | 10 ++-------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index df512be9..8b912ea6 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -1089,9 +1089,8 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; return NO; NSArray *readings = [self _currentReadings]; - NSString *composingBuffer = (ctlInputMethod.areWeUsingOurOwnPhraseEditor) - ? [readings componentsJoinedByString:@"-"] - : [readings componentsJoinedByString:@" "]; + NSString *composingBuffer = (IME.areWeUsingOurOwnPhraseEditor) ? [readings componentsJoinedByString:@"-"] + : [readings componentsJoinedByString:@" "]; [self clear]; diff --git a/Source/Modules/IME.swift b/Source/Modules/IME.swift index 4fd3a127..72d69719 100644 --- a/Source/Modules/IME.swift +++ b/Source/Modules/IME.swift @@ -28,6 +28,9 @@ import Cocoa static let dlgOpenPath = NSOpenPanel() + // MARK: - 開關判定當前應用究竟是? + @objc static var areWeUsingOurOwnPhraseEditor: Bool = false + // MARK: - Print debug information to the console. @objc static func prtDebugIntel(_ strPrint: String) { if mgrPrefs.isDebugModeEnabled { diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index 73f2c310..09ae6e20 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -271,9 +271,9 @@ class ctlInputMethod: IMKInputController { if (client as? IMKTextInput)?.bundleIdentifier() == "org.atelierInmu.vChewing.vChewingPhraseEditor" { - ctlInputMethod.areWeUsingOurOwnPhraseEditor = true + IME.areWeUsingOurOwnPhraseEditor = true } else { - ctlInputMethod.areWeUsingOurOwnPhraseEditor = false + IME.areWeUsingOurOwnPhraseEditor = false } let input = keyParser(event: event, isVerticalMode: useVerticalMode) @@ -767,12 +767,6 @@ extension ctlInputMethod { } } -// MARK: - 開關判定當前應用究竟是? - -@objc extension ctlInputMethod { - @objc static var areWeUsingOurOwnPhraseEditor: Bool = false -} - // MARK: - extension ctlInputMethod: KeyHandlerDelegate {