refactor: switch treeland IPC to Qt Remote Objects#96
Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
9c5c73a to
38f5a23
Compare
There was a problem hiding this comment.
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 switchesTreelandConnectorto call into the generatedTreelandDDMRemoteReplica. - 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 成对。
};
}
38f5a23 to
d13b4bb
Compare
|
已按这轮 review 收口:
之前 Copilot 提到的同步 control-socket I/O、协议版本、 |
d13b4bb to
40ceee2
Compare
|
|
||
| connect(socket, &QLocalSocket::disconnected, socket, &QLocalSocket::deleteLater); | ||
| connect(socket, &QLocalSocket::disconnected, this, [this] { | ||
| Q_EMIT disconnected(); |
There was a problem hiding this comment.
已处理:去掉了这里的 lambda,QLocalSocket::disconnected 现在直接连接到 deleteLater();同时不再额外通过 SocketServer::disconnected 做日志胶水。
| void SocketServer::login(QString user, QString password, int sessionType, QString sessionFile) { | ||
| qDebug() << "Message received from greeter: Login"; | ||
| Session session(static_cast<Session::Type>(sessionType), sessionFile); | ||
| Q_EMIT loginRequested(user, password, session); |
There was a problem hiding this comment.
不要搞这种设计呀,不能直接调用实现方的 login 方法吗?不要用这种发出信号,再在外面做一个胶水层的方式,多此一举。
There was a problem hiding this comment.
已处理:SocketServer 现在持有对应的 Display,远端 login/logout/lock/unlock/connectGreeter 请求会直接调用实现方方法,不再先发 loginRequested 等信号再由外层胶水转发。
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| class GreeterDDMRemote { | ||
| PROP(QString hostName) |
There was a problem hiding this comment.
已处理:这些属性已改成 SOURCEONLYSETTER。这样 ddm source 侧仍可更新属性值,但 replica/greeter 侧只能读取和订阅变更,语义上是远端只读。
f308bc0 to
1ca093d
Compare
|
TAG Bot New tag: 0.3.5 |
| for (Auth *auth : std::as_const(auths)) { | ||
| if (auth->sessionOpened) | ||
| writer << quint32(DaemonMessages::UserLoggedIn) << auth->user << auth->xdgSessionId; | ||
| m_socketServer->userLoggedIn(auth->user, auth->xdgSessionId); |
There was a problem hiding this comment.
这个做法挺奇怪的,应该是treeland启动后,主动通过ddm提供的SLOT来获取一个已登录的用户列表信息,而不是ddm自己发送信号通知这些已经登录的。信号应该只用来真的做通知,通知上一次登录请求的结果。
| authPtr); | ||
| session->setObjectName(QStringLiteral("logindSessionWatcher")); | ||
| connect(session, &OrgFreedesktopLogin1SessionInterface::Lock, this, [this, authPtr] { | ||
| if (authPtr) |
There was a problem hiding this comment.
如果不是当前的sessioin不要关心这个请求,因为treeland是global的,这时候如果锁屏,会出现a用户请求锁屏,结果把b用户锁定了的情况。如果用户当前不是激活用户,当前切换到b用户时,无论如何都会锁屏,所以这里的lock操作可以认为已经完成。
| if (authPtr) | ||
| m_socketServer->setSessionLocked(authPtr->xdgSessionId, true); | ||
| }); | ||
| connect(session, &OrgFreedesktopLogin1SessionInterface::Unlock, this, [this, authPtr] { |
There was a problem hiding this comment.
同上,我们不应该提供unlock操作,因为treeland锁屏和greeter是一个东西,进入了锁屏就没有当前用户的含义了,不应该能被用户进程请求解锁。
|
|
||
| setHostName(daemonApp->hostName()); | ||
| const auto capabilities = daemonApp->powerManager()->capabilities(); | ||
| setCanPowerOff(capabilities & Capability::PowerOff); |
There was a problem hiding this comment.
不应该搞成set的,应该重写属性的get方法,在里面返回这个数据。但是 daemonApp->powerManager() 的设计有些问题,这里是分开的几个属性,但是daemonApp->powerManager()里是把原本分开的东西聚合到了一起,如果这里分开的属性被分别调用,那daemonApp->powerManager()那边会有多次的重复调用,这一点也要优化
|
|
||
| void SocketServer::addUserSession(const QString &user, int sessionId) { | ||
| if (sessionId > 0) | ||
| userSessionAdded(user, sessionId); |
| userSessionAdded(user, sessionId); | ||
| } | ||
|
|
||
| void SocketServer::removeUserSession(const QString &user, int sessionId) { |
| userSessionRemoved(user, sessionId); | ||
| } | ||
|
|
||
| void SocketServer::setSessionLocked(int sessionId, bool locked) { |
ca02a71 to
b55c2cb
Compare
Replace the greeter IPC bridge with Qt Remote Objects endpoints. Use DDMRemote and TreelandRemote as cross-process call contracts. 将 greeter IPC 桥接改为 Qt Remote Objects 端点。 使用 DDMRemote 和 TreelandRemote 作为跨进程调用契约。 Log: 切换 Treeland 与 DDM 的 IPC 到 Qt Remote Objects Influence: 规范远程对象和 socket 命名,影响 DDM 与 Treeland 的登录/切换通信。
b55c2cb to
63e12e6
Compare
deepin pr auto review这是一次非常优秀的重构!此次代码审查的核心变更是将 以下是对本次重构代码的详细审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 一、 语法与逻辑
二、 代码质量
三、 代码性能
四、 代码安全
总结本次重构质量很高,将底层且容易出错的 Wayland C 绑定替换为了现代、类型安全的 Qt Remote Objects 框架,是一次非常成功的重构。 建议修改的优先级:
|
Summary
Testing