Conversation
PMS Bug 360241: left-clicking the tray icon of apps that do not implement StatusNotifierItem.Activate (e.g. Baidu Netdisk, Chromium based) did nothing. The Activate DBus call was fire-and-forget with no error handling, so the org.freedesktop.DBus.Error.UnknownMethod reply was silently dropped. Rework the left-click handling in SniTrayProtocolHandler::eventFilter: 1. Pre-check ItemIsMenu: items declaring ItemIsMenu now show the DBus menu directly instead of calling Activate (spec-compliant). 2. Wrap Activate(0,0) in a QDBusPendingCallWatcher to monitor the reply instead of ignoring it. 3. On Activate error, fall back to SecondaryActivate (also watched). 4. On SecondaryActivate error, show the DBus menu when a Menu path is available, otherwise call ContextMenu and finally attempt X11 window activation (EWMH _NET_ACTIVE_WINDOW) as a last resort. The X11 fallback is guarded by isXAvaliable()/non-zero WindowId and is skipped on Wayland. The DBus menu display path used by right-click is extracted into showTrayMenu() and reused by the fallback chain. Add Util::activateWindow() to issue the _NET_ACTIVE_WINDOW client message via the existing xcb connection. Refs: https://pms.uniontech.com/bug-view-360241.html
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Reviewer's GuideAdds asynchronous SNI Activate error handling with SecondaryActivate, menu, ContextMenu, and X11 window-activation fallbacks, while factoring shared tray-menu behavior and preserving XDG activation-token support. Sequence diagram for tiered SNI tray activation fallbacksequenceDiagram
participant User
participant Handler as SniTrayProtocolHandler
participant SNI as SNI DBus item
participant Menu as DBusMenuImporter
participant Util as Util X11
User->>Handler: activateWithFallback(clickPos)
alt ItemIsMenu
Handler->>Menu: showTrayMenu(clickPos)
else ItemIsMenu is false
Handler->>Handler: beginActivate(token, clickPos)
Handler->>SNI: Activate(0, 0)
SNI-->>Handler: Activate reply
alt Activate succeeds
else Activate fails
Handler->>SNI: SecondaryActivate(0, 0)
SNI-->>Handler: SecondaryActivate reply
alt SecondaryActivate succeeds
else SecondaryActivate fails
alt DBus menu available
Handler->>Menu: showTrayMenu(clickPos)
else No DBus menu
Handler->>SNI: ContextMenu(0, 0)
Handler->>Util: activateWindow(windowId)
end
end
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['trySecondaryActivate 方法可添加简短功能注释'] 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 暂无代码示例本报告由 AI 代码审查工具自动生成 |
Contributor
Author
|
该 BUG 是应用自己的问题,桌面环境层面无需解决 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景 / Background
PMS Bug 360241:百度网盘等基于 Chromium 的应用未实现
StatusNotifierItem.Activate方法,左键点击其托盘图标无任何反应。根因:
dde-tray-loader的 SNI 托盘左键点击处理(SniTrayProtocolHandler::eventFilter)对ActivateDBus 调用采用「发后即忘」方式,未监听回复、无错误处理、无 fallback。当应用未实现Activate时,DBus 返回org.freedesktop.DBus.Error.UnknownMethod,该错误被静默丢弃,点击事件丢失。修复方案 / Fix
按确认的修复方向,在
sniprotocolhandler.cpp中为 Activate 调用增加QDBusPendingCallWatcher错误监听与分级 fallback:改动点
ItemIsMenu=true的托盘项左键直接弹菜单(符合 SNI 规范),不再误调 Activate。QDBusPendingCallWatcher监听 Activate 异步回复,取代发后即忘。SecondaryActivate(同样监听)。ContextMenu。Util::activateWindow(),通过已有 xcb 连接发送 EWMH_NET_ACTIVE_WINDOWClientMessage 请求窗口管理器激活应用窗口。仅在 X11 可用(isXAvaliable())、WindowId 非零且窗口有效时触发,Wayland 下自动跳过。showTrayMenu(),左键 fallback 与右键共用,行为保持一致。安全性
QDBusPendingCallWatcher以this为 parent,finished 回调中deleteLater();handler 析构时 watcher(子对象)随之销毁并断开连接,无悬空回调。自审 / Self-review
sniprotocolhandler.cpp在真实 Qt6/DTK6 头文件 + 正确生成的 SNI 接口下-fsyntax-only通过;Util::activateWindow的 xcb 用法对真实<xcb/xcb.h>校验通过关联 / Related
Summary by Sourcery
Restore SNI tray left-click behavior by handling activation failures with progressively broader fallbacks.
New Features:
Bug Fixes:
Enhancements: