Skip to content

Commit 2c55b3a

Browse files
committed
fix: handle modifier key release events properly
1. Modified the modKeyReleasedCb function in shortcut_manager.go to handle CapsLock and Super keys differently 2. For CapsLock key release, now emits a key event with the key code instead of checking if keyboard is grabbed 3. For Super key release, now emits a key event without the previous grab check 4. NumLock key release handling remains unchanged 5. This fixes an issue where certain modifier key releases were not being properly processed Log: Fixed modifier key release handling for improved keyboard shortcut reliability Influence: 1. Test CapsLock key functionality - verify it works correctly when toggled 2. Test Super key (Windows/Command key) shortcuts - ensure they trigger properly 3. Verify that keyboard shortcuts involving modifier keys work consistently 4. Test keyboard grab state doesn't interfere with modifier key processing 5. Check that NumLock key behavior remains unchanged fix: 正确处理修饰键释放事件 1. 修改了 shortcut_manager.go 中的 modKeyReleasedCb 函数,以不同方式处理 CapsLock 和 Super 键 2. 对于 CapsLock 键释放,现在会发送带有键码的按键事件,而不是检查键盘是 否被占用 3. 对于 Super 键释放,现在会发送按键事件,不再进行之前的占用检查 4. NumLock 键释放处理保持不变 Log: 修复修饰键释放处理,提高键盘快捷键的可靠性 Influence: 1. 测试 CapsLock 键功能 - 验证切换时工作正常 2. 测试 Super 键(Windows/Command 键)快捷键 - 确保正确触发 3. 验证涉及修饰键的键盘快捷键工作一致 4. 测试键盘占用状态不会干扰修饰键处理 5. 检查 NumLock 键行为保持不变 PMS: BUG-316755
1 parent 5ab3f5b commit 2c55b3a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

keybinding1/shortcuts/shortcut_manager.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,12 @@ func NewShortcutManager(conn *x.Conn, keySymbols *keysyms.KeySymbols, eventCb Ke
190190
ss.xRecordEventHandler.modKeyReleasedCb = func(code uint8, mods uint16) {
191191
isGrabbed := isKbdAlreadyGrabbed(ss.conn)
192192
switch mods {
193-
case keysyms.ModMaskCapsLock, keysyms.ModMaskSuper:
194-
// caps_lock, supper
195-
if isGrabbed {
196-
return
197-
}
193+
case keysyms.ModMaskCapsLock:
194+
// caps_lock
195+
ss.emitKeyEvent(0, Key{Code: Keycode(code)})
196+
197+
case keysyms.ModMaskSuper:
198+
// super key
198199
ss.emitKeyEvent(0, Key{Code: Keycode(code)})
199200

200201
case keysyms.ModMaskNumLock:

0 commit comments

Comments
 (0)