Repository navigation
fix: adapt shortcuts to the Treeland v3 protocol - #205
yixinshark wants to merge 1 commit into
Conversation
Treeland now exposes shortcut-manager v3, so the v2 client cannot register shortcuts and legacy action IDs must no longer be sent as protocol values. Generate v3 bindings and preserve configuration and D-Bus action IDs through an explicit mapping. Replace commit acknowledgements with flush/display sync, handle individual and deferred binding failures, clear partial registrations, and restore old bindings when edits fail. Enable the implemented tiling, minimize and workspace-move actions, and keep unsupported actions unregistered. Add protocol regression coverage, declare the Qt Wayland test runtime package, and document the new lifecycle. The 13 shortcut test suites and six live Treeland scenarios passed; bulk startup registered and cleaned 100 bindings. Treeland 已改为提供 shortcut-manager v3,旧版客户端无法注册快捷键, 原有业务动作 ID 也不能再直接作为协议枚举发送。 切换到 v3 生成代码,通过显式映射保留配置和 D-Bus 动作 ID。 使用 flush/display sync 替代提交确认,处理逐条及延迟注册失败, 清理部分成功的绑定,并在修改失败时恢复旧绑定。启用已实现的平铺、 最小化和移动到相邻工作区动作,继续拒绝尚不支持的动作。 补充协议回归测试、Qt Wayland 测试运行依赖及生命周期文档。 13 组快捷键测试和 6 个真实 Treeland 场景通过,批量启动完成了 100 条绑定的注册和清理。 Log: adapt shortcuts to the Treeland v3 protocol Pms: TASK-397267 Change-Id: I9c2eb32345ee7003cac893449dc414309fbee347
|
[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 GuideMigrates shortcut registration to Treeland's v3 protocol, translating stable action IDs and replacing transactional commits with flush/sync plus failure compensation, while adding lifecycle documentation and comprehensive protocol regression tests. Sequence diagram for Treeland v3 shortcut registration and failure handlingsequenceDiagram
participant Manager as ShortcutManager
participant Handler as WaylandKeyHandler
participant Wrapper as TreelandShortcutWrapper
participant Treeland as TreelandV3
Manager->>Handler: registerKey(config)
Handler->>Wrapper: bind_key(name, key, flags, action)
Handler->>Wrapper: flushDeferred()
Wrapper->>Treeland: bind_key()
Wrapper->>Treeland: wl_display_flush()
Manager->>Handler: commitSync()
Handler->>Wrapper: syncAndWait()
Wrapper->>Treeland: wl_display_sync()
alt bind succeeds
Treeland-->>Wrapper: sync callback
Wrapper-->>Handler: true
else bind_failure
Treeland-->>Wrapper: bind_failure(name, error)
Wrapper-->>Handler: bindFailed(name, error)
Handler->>Wrapper: unbind(name)
Handler-->>Manager: registrationFailed(id)
end
Sequence diagram for compensating a failed shortcut editsequenceDiagram
participant Client as ShortcutManager
participant Handler as WaylandKeyHandler
participant Wrapper as TreelandShortcutWrapper
participant Treeland as TreelandV3
Client->>Handler: unregisterShortcut(id)
Handler->>Wrapper: unbind(oldName)
Client->>Handler: registerKey(newConfig)
Handler->>Wrapper: bind_key(newName, key, flags, action)
Client->>Handler: commitSync()
Handler->>Wrapper: syncAndWait()
Wrapper->>Treeland: wl_display_sync()
Treeland-->>Wrapper: bind_failure(newName, error)
Wrapper-->>Handler: bindFailed(newName, error)
Handler->>Wrapper: unbind(newName)
Client->>Handler: registerKey(oldConfig)
Handler->>Wrapper: bind_key(oldName, key, flags, action)
Handler->>Wrapper: flushDeferred()
Flow diagram for stable action ID translation to Treeland v3flowchart LR
Config["Saved configuration action ID"] --> Catalog["TriggerActionCatalog"]
Catalog -->|treelandActionId| Wire["Treeland v3 action ID"]
Wire --> Bind["bind_key or bind_swipe_gesture"]
Catalog -->|unsupported or disabled| Skip["No protocol binding"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本次代码无需修复,以下为 syncAndWait 的正确实现供参考: bool TreelandShortcutWrapper::syncAndWait(int timeoutMs) {
auto *display = waylandDisplay();
if (!isActive() || !display)
return false;
auto *callback = wl_display_sync(display);
if (!callback)
return false;
PendingSync sync;
sync.bindings = std::exchange(m_pendingBindings, {});
sync.failed = std::exchange(m_pendingBindFailed, false);
m_syncs.append(&sync);
static const wl_callback_listener listener = {
[](void *data, wl_callback *, uint32_t) {
auto *pending = static_cast<PendingSync *>(data);
pending->done = true;
pending->loop.quit();
}
};
wl_callback_add_listener(callback, &listener, &sync);
QPointer<TreelandShortcutWrapper> guard(this);
const auto *boundObject = object();
connect(this, &TreelandShortcutWrapper::protocolInactive, &sync.loop, &QEventLoop::quit);
connect(this, &QObject::destroyed, &sync.loop, &QEventLoop::quit);
QTimer timer;
timer.setSingleShot(true);
connect(&timer, &QTimer::timeout, &sync.loop, &QEventLoop::quit);
timer.start(timeoutMs);
flush();
sync.loop.exec();
wl_callback_destroy(callback);
if (!guard)
return false;
m_syncs.removeOne(&sync);
if (!sync.done)
qCWarning(logShortcut) << "Treeland shortcut sync did not complete within" << timeoutMs << "ms";
return sync.done && !sync.failed && isActive() && object() == boundObject;
}本报告由 AI 代码审查工具自动生成 |
Treeland now exposes only
treeland_shortcut_manager_v3, which prevents the v2 client from registering shortcuts. Its renumbered actions also require translating the service's existing configuration IDs before sending requests.Switch the generated bindings to v3 while preserving saved configuration and D-Bus action IDs. Replace commit acknowledgements with flush/display sync, handle individual and deferred failures, clean partial registrations, and restore old bindings when edits fail. Enable the implemented tiling, minimize and workspace-move actions, document the lifecycle, and add protocol regression tests with the required
qt6-wayland <!nocheck>dependency.Validation:
nocheckprofile.Physical touchpad input and real user-session switching were not exercised. The full repository configure was blocked locally by the unrelated power module's missing
xscrnsaverdependency; the shortcut targets were built through a temporary CMake entry point.Pms: TASK-397267
Summary by Sourcery
Adapt the shortcut backend to Treeland's v3 protocol while preserving compatibility with existing configurations and making registration failures recoverable.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: