Skip to content

refactor: switch treeland IPC to Qt Remote Objects#96

Open
zccrs wants to merge 1 commit into
linuxdeepin:masterfrom
zccrs:qremoteobject-treeland-ipc
Open

refactor: switch treeland IPC to Qt Remote Objects#96
zccrs wants to merge 1 commit into
linuxdeepin:masterfrom
zccrs:qremoteobject-treeland-ipc

Conversation

@zccrs

@zccrs zccrs commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the treeland Wayland client IPC in ddm with a Qt Remote Objects replica
  • remove the generated treeland-ddm Wayland client protocol from ddm
  • keep dde-seatd control socket handling unchanged

Testing

  • cmake --build build

@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 @zccrs, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zccrs

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

@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch 3 times, most recently from 9c5c73a to 38f5a23 Compare June 3, 2026 02:47
@zccrs zccrs requested a review from Copilot June 3, 2026 02:48

Copilot AI 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.

Pull request overview

Refactors ddm’s Treeland IPC from a generated Wayland client protocol to a Qt Remote Objects (QtRO) replica, aligning the daemon-side connector with Qt’s IPC stack and removing the build-time Wayland-client codegen dependency.

ddm 与 Treeland 的 IPC 进行重构:从原先生成的 Wayland client 协议切换为 Qt Remote Objects(QtRO)replica,使 daemon 侧连接器改用 Qt 的 IPC 机制,并移除构建期的 Wayland-client 协议代码生成依赖。

Changes:

  • Introduces a QtRO replica definition (treelandddmremote.rep) and switches TreelandConnector to call into the generated TreelandDDMRemoteReplica.
  • Removes Wayland client protocol code generation/linkage from CMake and adds Qt6 RemoteObjects dependency.
  • Updates distro/CI dependencies to include Qt Remote Objects (Debian Build-Depends, Arch workflow).

变更点:

  • 新增 QtRO replica 定义(treelandddmremote.rep),并让 TreelandConnector 通过生成的 TreelandDDMRemoteReplica 发起调用。
  • 从 CMake 中移除 Wayland client 协议生成/链接,并新增 Qt6 RemoteObjects 依赖。
  • 更新发行版/CI 依赖(Debian Build-Depends、Arch workflow)以包含 Qt Remote Objects。

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/daemon/treelandddmremote.rep Adds Qt Remote Objects replica interface for Treeland control methods.
src/daemon/TreelandConnector.h Updates connector interface/members for QtRO + local socket usage.
src/daemon/TreelandConnector.cpp Replaces Wayland IPC calls with QtRO replica acquisition and invocation logic.
src/daemon/CMakeLists.txt Hooks qt_add_repc_replicas() and links Qt6::RemoteObjects; removes Wayland-generated source.
CMakeLists.txt Drops Wayland client/TreelandProtocols discovery; adds Qt6 RemoteObjects requirement.
debian/control Adds qt6-remoteobjects-dev to Build-Depends.
.github/workflows/ddm-archlinux-build.yml Installs Qt Remote Objects dependency for Arch CI build.
Comments suppressed due to low confidence (1)

src/daemon/TreelandConnector.h:43

  • Include guards need to be closed at the end of the header (#endif).

建议:在文件末尾补上 #endif,与文件开头的 #ifndef/#define 成对。

};
}

Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/TreelandConnector.h Outdated
Comment thread src/daemon/TreelandConnector.h Outdated
Comment thread .github/workflows/ddm-archlinux-build.yml Outdated
Comment thread debian/control Outdated
Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/treelandddmremote.rep Outdated
Comment thread src/daemon/treelandddmremote.rep Outdated
@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch from 38f5a23 to d13b4bb Compare June 3, 2026 04:04
@zccrs

zccrs commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

已按这轮 review 收口:

  • TreelandConnector 里重复实现的 dde-seatd control socket / grouped-VT 逻辑已全部删除,VT 事件统一回到现有 DdeSeatdControl + SeatManager::handleVtChanged()
  • treelandddmremote.rep 已删掉未再使用的 activateSession/deactivateSession/enableRender/disableRender,两端接口只保留当前实际使用的 switchToGreeter/switchToUser
  • TreelandConnector.h 已改为 #pragma once,空的 setSignalHandler() 和未使用的 grouped-VT 包装接口一并移除。
  • debian/control、Arch/Deepin CI 中残留的 libwayland-dev / treeland-protocols 构建依赖已删除;本分支当前已不再使用这些构建输入。

之前 Copilot 提到的同步 control-socket I/O、协议版本、getpwnam()、TOCTOU 等问题,都是基于那套已经删掉的重复实现,当前 head 已不再适用。#endif 那条也是误报:这里现在用的是 #pragma once

@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch from d13b4bb to 40ceee2 Compare June 3, 2026 10:36
Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/TreelandConnector.cpp Outdated
Comment thread src/daemon/SocketServer.cpp Outdated
Comment thread src/daemon/SocketServer.cpp Outdated
Comment thread src/daemon/greeterddmremote.rep Outdated
Comment thread src/daemon/SocketServer.cpp Outdated
@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch 7 times, most recently from f308bc0 to 1ca093d Compare June 4, 2026 08:37
@deepin-bot

deepin-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.3.5
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #100

Comment thread src/daemon/Display.cpp Outdated
Comment thread src/daemon/Display.cpp Outdated
Comment thread src/daemon/Display.cpp
Comment thread src/daemon/SocketServer.cpp Outdated
Comment thread src/daemon/SocketServer.cpp Outdated
Comment thread src/daemon/SocketServer.cpp
Comment thread src/daemon/SocketServer.cpp Outdated
@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch 6 times, most recently from 63e12e6 to 94014e1 Compare June 8, 2026 03:44
@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch 11 times, most recently from 30206ea to d346c06 Compare June 11, 2026 03:56
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查报告

总体概述

这次代码更新主要涉及显示管理器(DDM)的重构,从Wayland协议直接通信转向使用Qt Remote Objects进行进程间通信。主要变化包括:

  1. 移除了Wayland协议直接通信代码
  2. 引入Qt Remote Objects进行进程间通信
  3. 简化了构建依赖,不再需要从源码构建treeland-protocols
  4. 重构了SocketServer和TreelandConnector的实现

具体分析

1. 构建系统改进

优点:

  • 移除了从源码构建treeland-protocols的步骤,简化了构建流程
  • 在Arch Linux构建中直接使用Qt6的RemoteObjects模块
  • 在Debian构建中移除了treeland-protocols依赖

建议:

  • 考虑添加版本检查以确保Qt6 RemoteObjects功能可用
  • 建议在CI/CD中测试不同Qt版本的兼容性

2. 通信架构改进

优点:

  • 使用Qt RemoteObjects替代直接Wayland协议通信,提高了可维护性
  • 通过.rep文件定义远程接口,提供了更好的类型安全性
  • 简化了进程间通信的复杂性

建议:

  • 考虑添加连接状态监控和自动重连机制
  • 建议添加通信超时处理,防止无限等待

3. 代码质量改进

优点:

  • 移除了大量重复代码,提高了代码复用性
  • 改进了错误处理和日志记录
  • 使用了更现代的C++特性

建议:

  • 考虑使用std::optional替代部分指针检查
  • 建议添加更多的单元测试,特别是针对远程通信部分

4. 性能考虑

优点:

  • 减少了不必要的进程间通信
  • 使用Qt的信号槽机制,提高了事件处理的效率

建议:

  • 考虑添加性能监控,特别是在高频操作时
  • 建议对频繁调用的远程方法进行优化

5. 安全性改进

优点:

  • 移除了直接操作Wayland协议的代码,减少了潜在的安全风险
  • 改进了认证流程,增加了对用户会话的更严格管理

建议:

  • 考虑添加通信数据的加密
  • 建议对远程方法调用进行更严格的权限检查

具体问题与建议

  1. TreelandConnector.cpp

    • 建议添加连接状态监控和自动重连机制
    • 考虑添加通信超时处理
  2. SocketServer.cpp

    • 建议添加错误处理和日志记录
    • 考虑添加连接限制,防止资源耗尽
  3. Display.cpp

    • 建议优化用户会话管理逻辑
    • 考虑添加会话超时机制
  4. PowerManager.cpp

    • 建议添加电源操作的权限检查
    • 考虑添加操作前的确认机制

总结

这次重构总体上是积极的,提高了代码的可维护性和可扩展性。主要改进包括:

  1. 简化了构建依赖
  2. 改进了进程间通信机制
  3. 提高了代码质量
  4. 增强了安全性

建议在后续开发中:

  1. 添加更多的单元测试和集成测试
  2. 完善错误处理和日志记录
  3. 添加性能监控和优化
  4. 考虑添加更多的安全措施

这些改进将有助于提高系统的稳定性和可靠性。

@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch from d346c06 to bdba11d Compare June 12, 2026 02:21
Publish session list and remembered user/session state from DDMRemote.

Serve DDMRemote directly on local:org.deepin.dde.ddm.qro.

Log: 通过 QtRO 向 Treeland 暴露完整 greeter 状态

Influence: Treeland 不再需要链接 libddm 即可获取 greeter 所需数据。
@zccrs zccrs force-pushed the qremoteobject-treeland-ipc branch from bdba11d to ad94775 Compare June 12, 2026 03:21
@deepin-bot

deepin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.3.6
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #102

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