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