ctlIME // Propagate application of setKeyLayout().
This commit is contained in:
parent
d27d469367
commit
3cebed6a23
|
@ -153,8 +153,8 @@ class ctlInputMethod: IMKInputController {
|
||||||
override func activateServer(_ client: Any!) {
|
override func activateServer(_ client: Any!) {
|
||||||
UserDefaults.standard.synchronize()
|
UserDefaults.standard.synchronize()
|
||||||
|
|
||||||
// Override the keyboard layout. Use US if not set.
|
// Override the keyboard layout to the basic one.
|
||||||
(client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout)
|
setKeyLayout(isfunctionKeyboardLayout: false)
|
||||||
// reset the state
|
// reset the state
|
||||||
currentCandidateClient = nil
|
currentCandidateClient = nil
|
||||||
|
|
||||||
|
@ -181,14 +181,17 @@ class ctlInputMethod: IMKInputController {
|
||||||
newInputMode = InputMode.imeModeNULL
|
newInputMode = InputMode.imeModeNULL
|
||||||
}
|
}
|
||||||
mgrLangModel.loadDataModel(newInputMode)
|
mgrLangModel.loadDataModel(newInputMode)
|
||||||
|
|
||||||
|
// Remember to override the keyboard layout again -- treat this as an activate event.
|
||||||
|
setKeyLayout(isfunctionKeyboardLayout: false)
|
||||||
|
|
||||||
if keyHandler.inputMode != newInputMode {
|
if keyHandler.inputMode != newInputMode {
|
||||||
UserDefaults.standard.synchronize()
|
UserDefaults.standard.synchronize()
|
||||||
// Remember to override the keyboard layout again -- treat this as an activate event.
|
|
||||||
(client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout)
|
|
||||||
keyHandler.clear()
|
keyHandler.clear()
|
||||||
keyHandler.inputMode = newInputMode
|
keyHandler.inputMode = newInputMode
|
||||||
self.handle(state: .Empty(), client: client)
|
self.handle(state: .Empty(), client: client)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 讓外界知道目前的簡繁體輸入模式。
|
// 讓外界知道目前的簡繁體輸入模式。
|
||||||
ctlInputMethod.currentKeyHandler.inputMode = keyHandler.inputMode
|
ctlInputMethod.currentKeyHandler.inputMode = keyHandler.inputMode
|
||||||
}
|
}
|
||||||
|
@ -208,7 +211,7 @@ class ctlInputMethod: IMKInputController {
|
||||||
// 同時注意:必須在 event.type == .flagsChanged 結尾插入 return false,
|
// 同時注意:必須在 event.type == .flagsChanged 結尾插入 return false,
|
||||||
// 否則,每次處理這種判斷時都會觸發 NSInternalInconsistencyException。
|
// 否則,每次處理這種判斷時都會觸發 NSInternalInconsistencyException。
|
||||||
if event.type == .flagsChanged {
|
if event.type == .flagsChanged {
|
||||||
(client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: getKeyLayoutFlagsCondition(event) ? mgrPrefs.functionKeyboardLayout : mgrPrefs.basisKeyboardLayout)
|
setKeyLayout(isfunctionKeyboardLayout: getKeyLayoutFlagsCondition(event))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue