Repo // Using new method to check client bundle identifiers.

This commit is contained in:
ShikiSuen 2022-08-14 16:27:13 +08:00
parent 5131fb523c
commit 787b5e4fd2
5 changed files with 5 additions and 23 deletions

View File

@ -18,6 +18,7 @@ import Cocoa
/// KeyHandler /// KeyHandler
protocol KeyHandlerDelegate { protocol KeyHandlerDelegate {
var clientBundleIdentifier: String { get }
func ctlCandidate() -> ctlCandidateProtocol func ctlCandidate() -> ctlCandidateProtocol
func keyHandler( func keyHandler(
_: KeyHandler, didSelectCandidateAt index: Int, _: KeyHandler, didSelectCandidateAt index: Int,

View File

@ -347,7 +347,7 @@ extension KeyHandler {
composingBuffer = Tekkon.cnvPhonaToHanyuPinyin(target: composingBuffer) // composingBuffer = Tekkon.cnvPhonaToHanyuPinyin(target: composingBuffer) //
} }
if !IME.areWeUsingOurOwnPhraseEditor { if let delegate = delegate, !delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") {
composingBuffer = composingBuffer.replacingOccurrences(of: "-", with: " ") composingBuffer = composingBuffer.replacingOccurrences(of: "-", with: " ")
} }

View File

@ -39,6 +39,7 @@ class ctlInputMethod: IMKInputController {
var state: InputStateProtocol = InputState.Empty() var state: InputStateProtocol = InputState.Empty()
/// ctlInputMethod /// ctlInputMethod
var isASCIIMode: Bool = false var isASCIIMode: Bool = false
/// ///
public var isVerticalTyping: Bool { public var isVerticalTyping: Bool {
guard let client = client() else { return false } guard let client = client() else { return false }
@ -233,15 +234,6 @@ class ctlInputMethod: IMKInputController {
// //
ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command]) ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command])
if let client = client(),
client.bundleIdentifier()
== "org.atelierInmu.vChewing.vChewingPhraseEditor"
{
IME.areWeUsingOurOwnPhraseEditor = true
} else {
IME.areWeUsingOurOwnPhraseEditor = false
}
var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping) var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping)
input.isASCIIModeInput = isASCIIMode input.isASCIIModeInput = isASCIIMode

View File

@ -13,6 +13,8 @@ import Cocoa
// MARK: - KeyHandler Delegate // MARK: - KeyHandler Delegate
extension ctlInputMethod: KeyHandlerDelegate { extension ctlInputMethod: KeyHandlerDelegate {
var clientBundleIdentifier: String { client()?.bundleIdentifier() ?? "" }
func ctlCandidate() -> ctlCandidateProtocol { ctlInputMethod.ctlCandidateCurrent } func ctlCandidate() -> ctlCandidateProtocol { ctlInputMethod.ctlCandidateCurrent }
func keyHandler( func keyHandler(
@ -84,15 +86,6 @@ extension ctlInputMethod: ctlCandidateDelegate {
// //
ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command]) ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command])
if let client = client(),
client.bundleIdentifier()
== "org.atelierInmu.vChewing.vChewingPhraseEditor"
{
IME.areWeUsingOurOwnPhraseEditor = true
} else {
IME.areWeUsingOurOwnPhraseEditor = false
}
var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping) var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping)
input.isASCIIModeInput = isASCIIMode input.isASCIIModeInput = isASCIIMode

View File

@ -40,10 +40,6 @@ public enum IME {
return text return text
} }
// MARK: -
static var areWeUsingOurOwnPhraseEditor: Bool = false
// MARK: - ctlInputMethod // MARK: - ctlInputMethod
static func getInputMode(isReversed: Bool = false) -> InputMode { static func getInputMode(isReversed: Bool = false) -> InputMode {