diff --git a/Source/Modules/PrefMgr_Extension.swift b/Source/Modules/PrefMgr_Extension.swift index 9595bf63..05ed04cb 100644 --- a/Source/Modules/PrefMgr_Extension.swift +++ b/Source/Modules/PrefMgr_Extension.swift @@ -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 diff --git a/Source/Modules/SessionCtl_Core.swift b/Source/Modules/SessionCtl_Core.swift index 16262948..82c56c17 100644 --- a/Source/Modules/SessionCtl_Core.swift +++ b/Source/Modules/SessionCtl_Core.swift @@ -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) } diff --git a/Source/Modules/SessionCtl_HandleDisplay.swift b/Source/Modules/SessionCtl_HandleDisplay.swift index c81dfe8f..9da1149e 100644 --- a/Source/Modules/SessionCtl_HandleDisplay.swift +++ b/Source/Modules/SessionCtl_HandleDisplay.swift @@ -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) } diff --git a/Source/Modules/UIModules/PrefUI/suiPrefPaneDevZone.swift b/Source/Modules/UIModules/PrefUI/suiPrefPaneDevZone.swift index 3c0851f9..36f88ccb 100644 --- a/Source/Modules/UIModules/PrefUI/suiPrefPaneDevZone.swift +++ b/Source/Modules/UIModules/PrefUI/suiPrefPaneDevZone.swift @@ -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 {