ctlIME // Reset KeyHandler if nil is passed to handle(event:).
This commit is contained in:
parent
f5bec584a5
commit
8f7d5a8a2a
|
@ -207,15 +207,16 @@ class ctlInputMethod: IMKInputController {
|
||||||
@objc(handleEvent:client:) override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
|
@objc(handleEvent:client:) override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
|
||||||
_ = sender // 防止格式整理工具毀掉與此對應的參數。
|
_ = sender // 防止格式整理工具毀掉與此對應的參數。
|
||||||
|
|
||||||
// 只針對特定類型的 client() 進行處理。
|
|
||||||
if !(sender is IMKTextInput) { return false }
|
|
||||||
|
|
||||||
// 更新此時的靜態狀態標記。
|
// 更新此時的靜態狀態標記。
|
||||||
ctlInputMethod.isASCIIModeSituation = isASCIIMode
|
ctlInputMethod.isASCIIModeSituation = isASCIIMode
|
||||||
ctlInputMethod.isVerticalTypingSituation = isVerticalTyping
|
ctlInputMethod.isVerticalTypingSituation = isVerticalTyping
|
||||||
|
|
||||||
// 就這傳入的 NSEvent 都還有可能是 nil,Apple InputMethodKit 團隊到底在搞三小。
|
// 就這傳入的 NSEvent 都還有可能是 nil,Apple InputMethodKit 團隊到底在搞三小。
|
||||||
guard let event = event else { return false }
|
// 只針對特定類型的 client() 進行處理。
|
||||||
|
guard let event = event, sender is IMKTextInput else {
|
||||||
|
resetKeyHandler()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// IMK 選字窗處理,當且僅當啟用了 IMK 選字窗的時候才會生效。
|
// IMK 選字窗處理,當且僅當啟用了 IMK 選字窗的時候才會生效。
|
||||||
// 這樣可以讓 interpretKeyEvents() 函式自行判斷:
|
// 這樣可以讓 interpretKeyEvents() 函式自行判斷:
|
||||||
|
|
Loading…
Reference in New Issue