fix: adapt control center activation for Wayland#1615
Conversation
1. Replace D-Bus direct calls with XdgActivation token-based activation 2. Use dde-application-manager (dde-am) as intermediary for Wayland protocol 3. Pass XDG_ACTIVATION_TOKEN environment variable when token is available 4. Update dependency to dde-application-manager >> 1.2.54 for required features 5. Simplify notification settings opening by removing DBus async call watcher 6. Add proper logging categories for quick panel and docking panel Log: Activated control center in Wayland via dde-am and XdgActivation protocol Influence: 1. Test opening dock settings in both X11 and Wayland sessions 2. Verify notification settings opening in both display servers 3. Check quick panel system settings entry works correctly 4. Ensure activation token is properly passed when available 5. Test backward compatibility with X11 sessions (no Wayland protocol) 6. Verify dde-am is invoked with correct arguments and environment 7. Check that token cleanup (deleteLater) works properly fix: 适配 Wayland 下激活控制中心 1. 使用 XdgActivation token 替代直接的 D-Bus 调用 2. 通过 dde-application-manager (dde-am) 作为 Wayland 协议中介 3. 在 token 可用时传递 XDG_ACTIVATION_TOKEN 环境变量 4. 更新依赖至 dde-application-manager >> 1.2.54 以支持新功能 5. 简化通知设置打开流程,移除 D-Bus 异步调用监听器 6. 为快捷面板和停靠面板添加正确的日志分类 Log: 通过 dde-am 和 XdgActivation 协议在 Wayland 下激活控制中心 Influence: 1. 在 X11 和 Wayland 会话中测试打开停靠设置 2. 验证两种显示服务器下的通知设置打开功能 3. 检查快捷面板系统设置入口是否正常工作 4. 确保 token 可用时正确传递激活令牌 5. 测试与 X11 会话的向后兼容性(无 Wayland 协议) 6. 验证 dde-am 使用正确的参数和环境变量调用 7. 检查 token 清理(deleteLater)是否正确执行 PMS: BUG-295555
There was a problem hiding this comment.
Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的Git Diff。本次代码变更的核心逻辑是将应用/设置页面的启动方式从D-Bus IPC调用迁移为通过 不过,在代码质量、逻辑鲁棒性和安全性方面,我发现了一些需要改进的地方。以下是详细的审查意见: 1. 代码逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与重构建议本次变更方向正确,适配了Wayland下的安全激活机制,但主要隐患在于信号未触发导致的死锁与内存泄漏。建议对启动逻辑进行如下重构提取,并增加容错: // 建议封装的工具函数示例
namespace DockLauncher {
void launchWithXdgActivation(const QString &appId, const QString &pagePath, QObject *parent) {
auto *activation = new ds::XdgActivation(parent);
// 超时保底机制
bool handled = false;
QTimer::singleShot(3000, activation, [activation, appId, pagePath, &handled]() {
if (handled) return;
handled = true;
qCWarning(dockLog) << "XdgActivation timeout, launching without token.";
QStringList args = {"--by-user", appId};
if (!pagePath.isEmpty()) {
args << "--" << "-p" << pagePath;
}
QProcess::startDetached("dde-am", args);
activation->deleteLater();
});
connect(activation, &ds::XdgActivation::tokenReady, activation, [activation, appId, pagePath, &handled](const QString &token) {
if (handled) return;
handled = true;
QStringList args = {"--by-user", appId};
if (!token.isEmpty()) {
qCDebug(dockLog) << "Passing XDG_ACTIVATION_TOKEN to dde-am";
args << "-e" << QStringLiteral("XDG_ACTIVATION_TOKEN=") + token;
}
if (!pagePath.isEmpty()) {
args << "--" << "-p" << pagePath;
}
QProcess::startDetached("dde-am", args);
activation->deleteLater();
});
activation->requestToken();
}
}通过以上改进,可以大幅提升代码的健壮性、安全性和可维护性。希望这些建议对你有所帮助! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
protocol
available
features
watcher
Log: Activated control center in Wayland via dde-am and XdgActivation
protocol
Influence:
fix: 适配 Wayland 下激活控制中心
Log: 通过 dde-am 和 XdgActivation 协议在 Wayland 下激活控制中心
Influence:
PMS: BUG-295555