Repo // Enable TDKCandidateBackports for macOS 10.15-11.

This commit is contained in:
ShikiSuen 2022-10-01 16:34:18 +08:00
parent 0685f2a390
commit d5e01b5adf
4 changed files with 24 additions and 19 deletions

View File

@ -12,10 +12,8 @@ import Shared
extension PrefMgr {
public func fixOddPreferences() {
// macOS 10.11 IMK macOS 10.13 IMK
// IMK macOS 10.09
// macOS 10.14 IMKCandidates
if #unavailable(macOS 12) { useIMKCandidateWindow = true }
// macOS 10.15 使 SwiftUI
if #unavailable(macOS 10.15) { useIMKCandidateWindow = true }
if #unavailable(macOS 10.15) {
handleDefaultCandidateFontsByLangIdentifier = false
shiftKeyAccommodationBehavior = 0

View File

@ -12,6 +12,7 @@ import IMKUtils
import PopupCompositionBuffer
import Shared
import ShiftKeyUpChecker
import TDKCandidateBackports
import TooltipUI
///
@ -34,6 +35,9 @@ class SessionCtl: IMKInputController {
if #available(macOS 12, *) {
return PrefMgr.shared.useIMKCandidateWindow
? CtlCandidateIMK(direction) : CtlCandidateTDK(direction)
} else if #available(macOS 10.15, *) {
return PrefMgr.shared.useIMKCandidateWindow
? CtlCandidateIMK(direction) : CtlCandidateTDKBackports(direction)
} else {
return CtlCandidateIMK(direction)
}

View File

@ -9,6 +9,7 @@
import CandidateWindow
import NSAttributedTextView
import Shared
import TDKCandidateBackports
// MARK: - Tooltip Display and Candidate Display Methods
@ -107,6 +108,10 @@ extension SessionCtl {
Self.ctlCandidateCurrent =
PrefMgr.shared.useIMKCandidateWindow
? CtlCandidateIMK(candidateLayout) : CtlCandidateTDK(candidateLayout)
} else if #available(macOS 10.15, *) {
Self.ctlCandidateCurrent =
PrefMgr.shared.useIMKCandidateWindow
? CtlCandidateIMK(candidateLayout) : CtlCandidateTDKBackports(candidateLayout)
} else {
Self.ctlCandidateCurrent = CtlCandidateIMK(candidateLayout)
}

View File

@ -50,22 +50,20 @@ struct suiPrefPaneDevZone: View {
)
.fixedSize(horizontal: false, vertical: true)
Divider()
if #available(macOS 12, *) {
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead of Tadokoro (will reboot the IME)"),
isOn: $selUseIMKCandidateWindow.onChange {
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApplication.shared.terminate(nil)
}
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead of Tadokoro (will reboot the IME)"),
isOn: $selUseIMKCandidateWindow.onChange {
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApplication.shared.terminate(nil)
}
)
Text(
LocalizedStringKey(
"IMK candidate window relies on certain Apple private APIs which are force-exposed by using bridging headers. Its usability, at this moment, is only guaranteed from macOS 10.14 Mojave to macOS 13 Ventura. Further tests are required in the future in order to tell whether it is usable in newer macOS releases. However, this mode is recommended at this moment since Tadokoro candidate window still needs possible improvements."
)
Text(
LocalizedStringKey(
"IMK candidate window relies on certain Apple private APIs which are force-exposed by using bridging headers. Its usability, at this moment, is only guaranteed from macOS 10.14 Mojave to macOS 13 Ventura. Further tests are required in the future in order to tell whether it is usable in newer macOS releases. However, this mode is recommended at this moment since Tadokoro candidate window still needs possible improvements."
)
)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
}
)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
Toggle(
LocalizedStringKey("Use .langIdentifier to handle UI fonts in candidate window"),
isOn: $selHandleDefaultCandidateFontsByLangIdentifier.onChange {