feat(shortcut): migrate treeland-shortcut-manager v2 → v3 - #1387
feat(shortcut): migrate treeland-shortcut-manager v2 → v3#1387deepin-wm wants to merge 2 commits into
Conversation
- Rename interface classes: ShortcutManagerV2→V3, ShortcutCaptureV1→V3 - Update protocol XML reference to treeland-shortcut-manager-unstable-v3.xml - Shift ShortcutAction enum values down by 1 (notify 1→0, etc.) - Remove commit mechanism (commit request, commit_success/failure events, error.invalid_commit, m_pendingCommittedShortcuts) - Add bind_failure event: per-binding failure reporting on immediate bind - Binds take effect immediately for active sessions; deferred for inactive - Update InterfaceVersion to 1 (v3 protocol resets version) - Fix pre-existing bug: unbind now removes from m_shortcuts map - Update all tests, examples, and helper references for v3 - 重命名接口类:ShortcutManagerV2→V3、ShortcutCaptureV1→V3 - 更新协议 XML 引用为 treeland-shortcut-manager-unstable-v3.xml - ShortcutAction 枚举值整体下移 1(notify 1→0 等) - 移除 commit 机制(commit 请求、commit_success/failure 事件、 error.invalid_commit、m_pendingCommittedShortcuts) - 新增 bind_failure 事件:即时绑定时逐条反馈失败 - 绑定对活跃会话立即生效,非活跃会话延迟到激活时生效 - InterfaceVersion 更新为 1(v3 协议重置版本号) - 修复既有 bug:unbind 现从 m_shortcuts 映射中移除 - 更新所有测试、示例和 helper 引用为 v3 Log: 适配 shortcut 模块到 treeland-protocols 0.6.0 的 v3 协议 Influence: shortcut 模块从 v2 迁移到 v3,移除 commit 机制,绑定改为 即时生效并新增逐条 bind_failure 反馈,影响快捷键注册与绑定流程。
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm 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 GuideMigrates Treeland shortcut management from protocol v2 to v3, replacing commit-based transactional binding with immediate per-bind registration and failure events, updating session lifecycle handling, examples, generated protocol integration, and protocol fixtures. Sequence diagram for v3 immediate and deferred shortcut bindingsequenceDiagram
participant Client
participant ShortcutManagerV3
participant ShortcutController
participant Session
Client->>ShortcutManagerV3: bind_key(name, key_sequence, flags, action)
alt active session
ShortcutManagerV3->>ShortcutController: registerKey(name, key, flags, action)
alt registration fails
ShortcutManagerV3-->>Client: bind_failure(name, error)
end
else inactive session
ShortcutManagerV3->>ShortcutManagerV3: queue bind_key
Session-->>ShortcutManagerV3: onSessionChanged()
ShortcutManagerV3->>ShortcutController: registerKey(name, key, flags, action)
alt registration fails
ShortcutManagerV3-->>Client: bind_failure(name, error)
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Fix two CI failures on the v2→v3 migration PR: 1. test event.no_bind_failure_upsert: registerKey() checked m_deleters.contains(name) and returned name_conflict before reaching the upsert logic (same key+action → update flags). Re-binding the same name to the same key+action is an in-place flag update, not a conflict. Reorder so the upsert check runs first; name_conflict now only fires when the name is already used by a different key+action binding. Also update ShortcutManagerV3Private::registerKey() to replace the existing same-name entry on upsert instead of appending a duplicate. 2. SPDX license-header year: tests/test_protocol_shortcut/main.cpp had 2024-2025 but the file was modified in 2026. Update to 2024-2026. Verified: all 10 steps of test_treeland_shortcut_manager_v3 pass, including event.no_bind_failure_upsert and event.bind_failure_name_conflict.
|
TAG Bot New tag: 0.10.0 |
概述
适配 treeland 的 shortcut 模块到 treeland-protocols 0.6.0 的 breaking 变更,将
treeland-shortcut-manager从 v2 迁移到 v3。变更内容
treeland_shortcut_manager_v2→_v3,treeland_shortcut_capture_v2→_v3commit请求、commit_success/commit_failure事件、error.invalid_commit全部删除bind_failure事件:逐绑定反馈失败,不再回滚同批次其他绑定invalid_surface从 4→3,移除invalid_commitsince属性unbind现从m_shortcuts映射中移除;移除onSessionChanged中的 early return测试
tests/protocols/下 desktop-v3 和基础 v3 两个 fixture,覆盖 capture→captured、即时 bind_key→activated、acquire、bind_key 成功/upsert/name_conflict 等链路examples/test_shortcut_manager和examples/test_shortcut_capture示例代码,移除 commit 逻辑关联
Summary by Sourcery
Migrate Treeland shortcut management from protocol v2 to v3 and adopt immediate, per-binding registration semantics.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests:
Chores: