fix: monitor X11 lock state changes through XKB - #128
Conversation
There was a problem hiding this comment.
Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThis PR wires XKB-based monitoring of X11 modifier lock state (Caps/Num Lock) into the existing shortcut backend, propagates lock changes through the key handler and keybinding manager, and centralizes/filters emission of the exported D-Bus state-change signals to avoid duplicates. Sequence diagram for XKB lock state propagationsequenceDiagram
participant XServer
participant X11KeyHandler
participant KeybindingManager
participant DbusClients
XServer->>X11KeyHandler: XkbStateNotify
X11KeyHandler->>X11KeyHandler: notifyLockStateChange(event)
alt [Num Lock changed]
X11KeyHandler-->>KeybindingManager: numLockStateChanged(on)
KeybindingManager->>KeybindingManager: updateNumLockState(on)
KeybindingManager-->>DbusClients: NumLockStateChanged(state)
end
alt [Caps Lock changed]
X11KeyHandler-->>KeybindingManager: capsLockStateChanged(on)
KeybindingManager->>KeybindingManager: updateCapsLockState(on)
KeybindingManager-->>DbusClients: CapsLockStateChanged(state)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Subscribe to XKB modifier lock state notifications independently of passive shortcut grabs. Propagate Caps Lock and Num Lock changes through the key handler and deduplicate the exported D-Bus signals. This also observes lock state changes made through XKB APIs without physical key press events. 独立于被动快捷键抓取订阅 XKB 修饰键锁定状态通知。 通过按键处理后端传递大小写锁定和数字锁定状态变化,并对导出的 D-Bus 信号去重。 同时支持检测通过 XKB API 直接修改且没有物理按键事件的锁定状态变化。 Log: monitor X11 lock state changes through XKB Pms: BUG-372751 Change-Id: I923a352f91a63218d287bb013464538a65b27c56
cc94572 to
0639b49
Compare
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已非常完善,无需额外修改。以下为符合当前风格的扩展性建议示例(如未来需支持Wayland):
// 在 abstractkeyhandler.cpp 中可预留空实现,确保接口多态完整性
void AbstractKeyHandler::enableLockStateMonitoring()
{
// Default no-op for non-X11 backends (e.g., Wayland)
} |
Summary
Tests
cmake --build build --target plugin-dde-shortcut -j2git diff --checkPms: BUG-372751
Summary by Sourcery
Handle X11 keyboard lock state changes via XKB and ensure consistent, deduplicated propagation of Caps Lock and Num Lock state updates through the shortcut subsystem.
Bug Fixes:
Enhancements: