Активировать нативный черновик до записи
This commit is contained in:
@@ -87,6 +87,12 @@ private final class CompositionCoordinator: @unchecked Sendable {
|
||||
@objc(WhisperKeyInputController)
|
||||
final class WhisperKeyInputController: IMKInputController {
|
||||
private var draft = ""
|
||||
private static let wakeModifiers: NSEvent.ModifierFlags = [
|
||||
.command,
|
||||
.option,
|
||||
.control,
|
||||
.shift,
|
||||
]
|
||||
|
||||
override init!(server: IMKServer!, delegate: Any!, client inputClient: Any!) {
|
||||
super.init(server: server, delegate: delegate, client: inputClient)
|
||||
@@ -118,6 +124,16 @@ final class WhisperKeyInputController: IMKInputController {
|
||||
super.inputControllerWillClose()
|
||||
}
|
||||
|
||||
override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
|
||||
let isWakeEvent = event.type == .keyDown
|
||||
&& event.keyCode == UInt16(kVK_F20)
|
||||
&& event.modifierFlags.contains(Self.wakeModifiers)
|
||||
if isWakeEvent {
|
||||
inputLog.notice("wake event consumed")
|
||||
}
|
||||
return isWakeEvent
|
||||
}
|
||||
|
||||
func setDraft(_ text: String) {
|
||||
inputLog.notice(
|
||||
"setting marked text for \(self.client().bundleIdentifier(), privacy: .public)"
|
||||
|
||||
Reference in New Issue
Block a user