fix(keybinding): stop stealing chords on Windows, release mouse holds, keep cleared actions
This commit is contained in:
parent
115e8488ac
commit
1a4c39cb94
8 changed files with 927 additions and 148 deletions
|
|
@ -14,12 +14,16 @@ import {
|
|||
isKeyBinding,
|
||||
isKeyBindingActionId,
|
||||
normalizeBinding,
|
||||
parseBindingMap,
|
||||
validateBinding
|
||||
} from '@d3ro/core/keybinding'
|
||||
import { getKeyBindingService } from '../services/KeyBindingService'
|
||||
import type { KeyBindingTriggerPayload } from '../services/KeyBindingService'
|
||||
import { configGet, configSet } from '../services/ConfigService'
|
||||
import {
|
||||
configGet,
|
||||
configSet,
|
||||
loadKeyBindings,
|
||||
saveKeyBindings
|
||||
} from '../services/ConfigService'
|
||||
import type {
|
||||
KeyBinding,
|
||||
KeyBindingChangedEvent,
|
||||
|
|
@ -44,16 +48,19 @@ function broadcastChanged(map: KeyBindingMap): void {
|
|||
broadcast(IPC_CHANNELS.KEYBINDING.CHANGED, event)
|
||||
}
|
||||
|
||||
/** 저장된 맵을 읽는다. 손상·누락 항목은 기본값으로 복원한다. */
|
||||
/**
|
||||
* 저장된 맵을 읽는다. 손상·누락 항목은 기본값으로 복원하고, 사용자가 비운 액션(`[]`)은
|
||||
* 비운 그대로 둔다 — 다른 액션을 고칠 때 지운 단축키가 되살아나지 않도록.
|
||||
*/
|
||||
function readMap(): KeyBindingMap {
|
||||
return parseBindingMap(configGet('keyBindings'))
|
||||
return loadKeyBindings()
|
||||
}
|
||||
|
||||
/** 맵을 저장하고 후킹 서비스에 다시 태운 뒤 창에 알린다. */
|
||||
function applyMap(map: KeyBindingMap): void {
|
||||
configSet('keyBindings', map)
|
||||
const saved = saveKeyBindings(map)
|
||||
getKeyBindingService().loadFromConfig()
|
||||
broadcastChanged(map)
|
||||
broadcastChanged(saved)
|
||||
}
|
||||
|
||||
/** uiohook 트리거를 렌더러로 중계한다. 재등록 시 리스너가 중복되지 않게 이전 것을 떼어낸다. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue