Skip to content

feat: implement xdg-activation-v1 protocol for tray protocol handler#462

Merged
18202781743 merged 1 commit into
masterfrom
agent/agent/b3d3b5cf
Jun 8, 2026
Merged

feat: implement xdg-activation-v1 protocol for tray protocol handler#462
18202781743 merged 1 commit into
masterfrom
agent/agent/b3d3b5cf

Conversation

@18202781743

@18202781743 18202781743 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Implement xdg-activation-v1 protocol support in the system tray protocol handler to provide proper XDG activation tokens for application window management, aligned with dde-shell implementation. This change moves the XdgActivation class to the dockpluginmanager-interface library for shared use across dock components.

Key changes:

  1. Add XdgActivation class to dockpluginmanager-interface library
  2. Implement xdg-activation-v1 Wayland protocol client integration
  3. Update tray protocol handler to use XDG activation token when activating SNI items
  4. Add ProvideXdgActivationToken method to SNI DBus interface
  5. Update library dependencies and CMake build configuration

Log: Implemented XDG activation protocol for proper window focus management

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-bot

deepin-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.33
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #463

Implement xdg-activation-v1 protocol support in the system tray protocol
handler to provide proper XDG activation tokens for application window
management, aligned with dde-shell implementation. This change moves
the XdgActivation class to the dockpluginmanager-interface library for
shared use across dock components.

Key changes:
1. Add XdgActivation class to dockpluginmanager-interface library
2. Implement xdg-activation-v1 Wayland protocol client integration
3. Update tray protocol handler to use XDG activation token when
activating SNI items
4. Add ProvideXdgActivationToken method to SNI DBus interface
5. Update library dependencies and CMake build configuration

Log: Implemented XDG activation protocol for proper window focus management

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@18202781743 18202781743 force-pushed the agent/agent/b3d3b5cf branch from eeaba89 to fee4de7 Compare June 8, 2026 06:30
@18202781743 18202781743 changed the title feat: add xdg-activation-v1 client for SNI tray activation token feat: implement xdg-activation-v1 protocol for tray protocol handler Jun 8, 2026
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查报告

总体概述

这个补丁主要添加了Wayland环境下的XdgActivation支持,用于处理系统托盘应用的激活令牌(token)请求。代码整体结构清晰,实现较为完整,但仍有一些可以改进的地方。

具体分析

1. CMakeLists.txt 修改

  • 添加了wayland-protocols的查找和使用
  • 添加了Dtk::Core依赖
  • 添加了Wayland协议文件生成

建议

  • 在查找wayland-protocols时应该添加版本检查,确保协议版本兼容性
  • 建议添加if(Wayland_FOUND)条件检查,确保Wayland环境可用

2. DBus接口修改

  • 添加了ProvideXdgActivationToken方法

建议

  • 建议在文档注释中说明该方法的用途和参数含义
  • 考虑添加参数验证逻辑

3. sniprotocolhandler.cpp 修改

  • 实现了XdgActivation令牌的请求和使用逻辑

建议

  • 内存管理:当前使用deleteLater()可能会导致对象延迟删除,建议在确保不再使用后立即删除
  • 错误处理:当activation->isActive()返回false时,直接调用m_sniInter->Activate(0, 0)可能会忽略潜在的错误
  • 代码结构:建议将XdgActivation相关的逻辑封装为单独的方法,提高代码可读性

4. 新增XdgActivation相关文件

  • 实现了完整的XdgActivation功能

优点

  • 代码结构清晰,使用了良好的封装
  • 日志记录完善
  • 错误处理较为完整

建议

  • XdgActivation::requestToken方法中,建议添加超时机制,避免无限等待
  • XdgActivationTokenV1类可以考虑使用智能指针管理生命周期
  • 建议添加更多的输入参数验证
  • activationV1()函数中,可以考虑添加错误处理机制,当初始化失败时返回nullptr

5. 安全性考虑

  • 令牌处理过程中没有明显的安全漏洞
  • 建议在令牌传输过程中考虑添加加密或验证机制

性能考虑

  • 使用了QPointer管理对象生命周期,避免了悬空指针问题
  • 使用了Qt的信号槽机制,确保线程安全

建议

  • 考虑在频繁调用的地方添加性能优化
  • 可以考虑使用对象池来管理XdgActivationTokenV1对象

总结

这个补丁实现了Wayland环境下的XdgActivation功能,代码整体质量较高,结构清晰。主要改进建议集中在错误处理、内存管理和代码结构优化方面。建议在合并前考虑上述建议,特别是添加超时机制和更完善的错误处理。

@18202781743 18202781743 requested review from BLumia and mhduiy June 8, 2026 06:47
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743 18202781743 merged commit 95ad359 into master Jun 8, 2026
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants