SessionCtl // Removing shiftKeyAccommodationBehavior.
This commit is contained in:
parent
72560e82e2
commit
e49d60447c
|
@ -60,6 +60,7 @@ extension SessionCtl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切換英數模式開關。
|
||||||
func toggleAlphanumericalMode() {
|
func toggleAlphanumericalMode() {
|
||||||
let status = "NotificationSwitchASCII".localized
|
let status = "NotificationSwitchASCII".localized
|
||||||
Notifier.notify(
|
Notifier.notify(
|
||||||
|
@ -70,25 +71,14 @@ extension SessionCtl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
||||||
let shouldUseShiftToggleHandle: Bool = {
|
// 警告:這裡的 event 必須是原始 event 且不能被 var,否則會影響 Shift 中英模式判定。
|
||||||
switch PrefMgr.shared.shiftKeyAccommodationBehavior {
|
|
||||||
case 0: return false
|
|
||||||
case 1: return Shared.arrClientShiftHandlingExceptionList.contains(clientBundleIdentifier)
|
|
||||||
case 2: return true
|
|
||||||
default: return false
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
/// 警告:這裡的 event 必須是原始 event 且不能被 var,否則會影響 Shift 中英模式判定。
|
|
||||||
if #available(macOS 10.15, *) {
|
if #available(macOS 10.15, *) {
|
||||||
if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
|
if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
|
||||||
if shouldUseShiftToggleHandle {
|
|
||||||
if !rencentKeyHandledByInputHandlerEtc {
|
if !rencentKeyHandledByInputHandlerEtc {
|
||||||
toggleAlphanumericalMode()
|
toggleAlphanumericalMode()
|
||||||
} else {
|
} else {
|
||||||
rencentKeyHandledByInputHandlerEtc = false
|
rencentKeyHandledByInputHandlerEtc = false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +150,7 @@ extension SessionCtl {
|
||||||
|
|
||||||
/// 直接交給 commonEventHandler 來處理。
|
/// 直接交給 commonEventHandler 來處理。
|
||||||
let result = inputHandler.handleEvent(eventToDeal)
|
let result = inputHandler.handleEvent(eventToDeal)
|
||||||
if shouldUseShiftToggleHandle { rencentKeyHandledByInputHandlerEtc = result }
|
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