SessionCtl // Remove rencentKeyHandledByInputHandlerEtc.
This commit is contained in:
parent
e49d60447c
commit
fde7a7a42a
|
@ -90,9 +90,6 @@ public class SessionCtl: IMKInputController {
|
||||||
public static var theShiftKeyDetector = ShiftKeyUpChecker(
|
public static var theShiftKeyDetector = ShiftKeyUpChecker(
|
||||||
useLShift: PrefMgr.shared.togglingAlphanumericalModeWithLShift)
|
useLShift: PrefMgr.shared.togglingAlphanumericalModeWithLShift)
|
||||||
|
|
||||||
/// `handle(event:)` 會利用這個參數判定某次 Shift 按鍵是否用來切換中英文輸入。
|
|
||||||
public var rencentKeyHandledByInputHandlerEtc = false
|
|
||||||
|
|
||||||
/// 記錄當前輸入環境是縱排輸入還是橫排輸入。
|
/// 記錄當前輸入環境是縱排輸入還是橫排輸入。
|
||||||
public static var isVerticalTyping: Bool = false
|
public static var isVerticalTyping: Bool = false
|
||||||
public var isVerticalTyping: Bool = false {
|
public var isVerticalTyping: Bool = false {
|
||||||
|
|
|
@ -72,15 +72,9 @@ extension SessionCtl {
|
||||||
|
|
||||||
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
||||||
// 警告:這裡的 event 必須是原始 event 且不能被 var,否則會影響 Shift 中英模式判定。
|
// 警告:這裡的 event 必須是原始 event 且不能被 var,否則會影響 Shift 中英模式判定。
|
||||||
if #available(macOS 10.15, *) {
|
if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
|
||||||
if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
|
toggleAlphanumericalMode()
|
||||||
if !rencentKeyHandledByInputHandlerEtc {
|
return true
|
||||||
toggleAlphanumericalMode()
|
|
||||||
} else {
|
|
||||||
rencentKeyHandledByInputHandlerEtc = false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用 JIS 鍵盤的英數切換鍵來切換中英文模式。
|
// 用 JIS 鍵盤的英數切換鍵來切換中英文模式。
|
||||||
|
@ -150,7 +144,6 @@ extension SessionCtl {
|
||||||
|
|
||||||
/// 直接交給 commonEventHandler 來處理。
|
/// 直接交給 commonEventHandler 來處理。
|
||||||
let result = inputHandler.handleEvent(eventToDeal)
|
let result = inputHandler.handleEvent(eventToDeal)
|
||||||
rencentKeyHandledByInputHandlerEtc = result
|
|
||||||
if !result {
|
if !result {
|
||||||
// 除非是 .ofMarking 狀態,否則讓某些不用去抓的按鍵起到「取消工具提示」的作用。
|
// 除非是 .ofMarking 狀態,否則讓某些不用去抓的按鍵起到「取消工具提示」的作用。
|
||||||
if [.ofEmpty].contains(state.type) { tooltipInstance.hide() }
|
if [.ofEmpty].contains(state.type) { tooltipInstance.hide() }
|
||||||
|
|
Loading…
Reference in New Issue