Repo // Disable DevZone for macOS 10.11 and 10.12.

- IMKCandidates can crash on macOS 10.11 El Capitan.
This commit is contained in:
ShikiSuen 2022-08-15 12:29:15 +08:00
parent 37e1364f93
commit fad4e213bc
2 changed files with 17 additions and 6 deletions

View File

@ -107,11 +107,15 @@ class ctlInputMethod: IMKInputController {
// activateServer nil // activateServer nil
// //
if keyHandler.delegate == nil { keyHandler.delegate = self } if keyHandler.delegate == nil { keyHandler.delegate = self }
guard let client = client() else { return } setValue(IME.currentInputMode.rawValue, forTag: 114_514, client: client())
setValue(IME.currentInputMode.rawValue, forTag: 114_514, client: client)
keyHandler.clear() // handle State.Empty() keyHandler.clear() // handle State.Empty()
keyHandler.ensureParser() keyHandler.ensureParser()
if #available(macOS 10.13, *) {
} else {
mgrPrefs.useIMKCandidateWindow = false // macOS 10.11 IMK
}
if isASCIIMode { if isASCIIMode {
if mgrPrefs.disableShiftTogglingAlphanumericalMode { if mgrPrefs.disableShiftTogglingAlphanumericalMode {
isASCIIMode = false isASCIIMode = false
@ -128,7 +132,7 @@ class ctlInputMethod: IMKInputController {
/// ///
/// macOS /// macOS
if client.bundleIdentifier() != Bundle.main.bundleIdentifier { if let client = client(), client.bundleIdentifier() != Bundle.main.bundleIdentifier {
// 使 // 使
setKeyLayout() setKeyLayout()
handle(state: InputState.Empty()) handle(state: InputState.Empty())

View File

@ -335,16 +335,23 @@ extension ctlPrefWindow: NSToolbarDelegate {
window.contentView?.addSubview(view) window.contentView?.addSubview(view)
} }
var toolbarIdentifiers: [NSToolbarItem.Identifier] {
if #available(macOS 10.13, *) {
return [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDevZone]
}
return [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard]
}
func toolbarDefaultItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { func toolbarDefaultItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] {
[.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDevZone] toolbarIdentifiers
} }
func toolbarAllowedItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { func toolbarAllowedItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] {
[.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDevZone] toolbarIdentifiers
} }
func toolbarSelectableItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { func toolbarSelectableItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] {
[.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDevZone] toolbarIdentifiers
} }
@objc func showGeneralView(_: Any?) { @objc func showGeneralView(_: Any?) {