IMEApp // Implement .isKeyboardJIS().
This commit is contained in:
parent
63422c9841
commit
153572b826
|
@ -7,6 +7,7 @@
|
|||
// requirements defined in MIT License.
|
||||
|
||||
import AppKit
|
||||
import Carbon
|
||||
import Shared
|
||||
|
||||
// MARK: - Top-level Enums relating to Input Mode and Language Supports.
|
||||
|
@ -58,6 +59,11 @@ public enum IMEApp {
|
|||
.init(rawValue: PrefMgr.shared.mostRecentInputMode) ?? .imeModeNULL
|
||||
}
|
||||
|
||||
/// 當前鍵盤是否是 JIS 佈局
|
||||
public static var isKeyboardJIS: Bool {
|
||||
KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS
|
||||
}
|
||||
|
||||
/// Fart or Beep?
|
||||
public static func buzz() {
|
||||
if PrefMgr.shared.isDebugModeEnabled {
|
||||
|
|
|
@ -232,8 +232,7 @@ extension InputHandler {
|
|||
let ctrlShiftCMD: Bool = input.keyModifierFlags == [.control, .command, .shift]
|
||||
if ctrlShiftCMD || ctrlCMD {
|
||||
// 此處 JIS 鍵盤判定無法用於螢幕鍵盤。所以,螢幕鍵盤的場合,系統會依照 US 鍵盤的判定方案。
|
||||
let isJIS: Bool = KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS
|
||||
switch (input.keyCode, isJIS) {
|
||||
switch (input.keyCode, IMEApp.isKeyboardJIS) {
|
||||
case (30, true), (33, false):
|
||||
_ = ctlCandidate.highlightPreviousCandidate() ? {}() : delegate.callError("8B144DCD")
|
||||
return true
|
||||
|
|
|
@ -164,8 +164,7 @@ public extension InputHandler {
|
|||
revolveCandidateWithBrackets: if ctrlShiftCMD || ctrlCMD {
|
||||
if state.type != .ofInputting { break revolveCandidateWithBrackets }
|
||||
// 此處 JIS 鍵盤判定無法用於螢幕鍵盤。所以,螢幕鍵盤的場合,系統會依照 US 鍵盤的判定方案。
|
||||
let isJIS: Bool = KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS
|
||||
switch (input.keyCode, isJIS) {
|
||||
switch (input.keyCode, IMEApp.isKeyboardJIS) {
|
||||
case (30, true), (33, false): return revolveCandidate(reverseOrder: true)
|
||||
case (42, true), (30, false): return revolveCandidate(reverseOrder: false)
|
||||
default: break
|
||||
|
|
Loading…
Reference in New Issue