Repository navigation
fix: resolve show-desktop panel flicker and state desync - #1762
Merged
deepin-bot[bot] merged 1 commit intoOct 14, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe change fixes Show Desktop flicker by explicitly closing active dock popups first, and prevents toggle desynchronization by tracking the requested state independently from compositor callbacks. Review the popup lifecycle interaction and repeated-toggle behavior, especially when no windows are present. Sequence diagram for flicker-free Show Desktop activationsequenceDiagram
actor User
participant ShowDesktop as showdesktop.qml
participant Panel
participant Applet
participant Compositor
User->>ShowDesktop: onClicked
ShowDesktop->>Panel: requestClosePopup()
Panel-->>ShowDesktop: Popup closed
ShowDesktop->>Applet: toggleShowDesktop()
Applet->>Compositor: set_show_desktop_state(requestedState)
Compositor-->>Applet: Apply Show Desktop state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/dock/showdesktop/treelandshowdesktop.cpp" line_range="21" />
<code_context>
{
if (isActive()) {
- set_show_desktop_state(m_desktopState == state_show ? state_normal : state_show);
+ m_requestedState = (m_requestedState == state_show) ? state_normal : state_show;
+ set_show_desktop_state(m_requestedState);
}
</code_context>
<issue_to_address>
**First click repeats active state**
When the compositor is already showing the desktop at startup or another actor changes its state, `m_requestedState` remains `state_normal` because compositor updates change only `m_desktopState`; `desktopToggle()` therefore sends `state_show` again instead of restoring the windows, and the dock button appears unresponsive.
Base the toggle on the compositor-reported `m_desktopState` (or keep `m_requestedState` synchronized with it) before sending the request.
Also at `panels/dock/showdesktop/treelandshowdesktop.cpp:13`.
</issue_to_address>Root cause: showdesktop.qml onClicked handler called toggleShowDesktop() without first closing the active popup, causing treeland to briefly toggle popup visibility during show-desktop processing, resulting in a visible flicker. Fix: add Panel.requestClosePopup() before toggleShowDesktop() call, consistent with all other dock interaction paths. Log: Fixed panel flicker when triggering show-desktop with plugin panels open Influence: 1. Test show-desktop with quick-settings/network/calendar panel open 2. Verify no regression on normal show-desktop with windows present PMS: BUG-379453
wjyrich
force-pushed
the
agent/pms-bug-bot/4a1e6f786c39
branch
from
October 14, 2026 02:46
02a6d6a to
96ed243
Compare
BLumia
approved these changes
Oct 14, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, wjyrich 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 |
Contributor
Author
|
/forcemerge |
|
This pr force merged! (status: blocked) |
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.
Root Cause Analysis
When triggering "Show Desktop" with a dock plugin panel (quick-settings, network, calendar, etc.) open, the panel flickers once before disappearing. The root cause is twofold:
Panel flicker:
showdesktop.qml'sonClickedhandler callsApplet.toggleShowDesktop()without first closing the active popup viaPanel.requestClosePopup(). Since the popup is a transient child of the dock panel window, treeland briefly toggles its visibility during show-desktop processing, causing the flicker. All other dock interaction paths (blank-area click, position change, context menu) already callPanel.requestClosePopup()— this path was missed.State desync:
desktopToggle()intreelandshowdesktop.cppusedm_desktopState(updated by compositor callbacks) to decide toggle direction. When no windows are on the desktop, the compositor-reported state can desync from the user's intended state, causing the first toggle to have no effect and requiring a second toggle.Fix
Panel.requestClosePopup()beforeApplet.toggleShowDesktop()inshowdesktop.qml'sonClicked, consistent with all other dock interaction paths.m_requestedStatemember variable inTreelandShowDesktopto track the user's intended state.desktopToggle()now bases its toggle direction onm_requestedStateinstead ofm_desktopState, which is still updated by compositor callbacks but no longer affects toggle decisions.Change Safety Assessment
Code Safety
m_desktopStateis still maintained by compositor callbacks for state reporting; only the toggle decision logic shifted tom_requestedState, preserving existing behavior for external observers.Business Impact Scope
Verification Suggestion
根因分析
在打开任务栏插件面板(快捷设置、网络、日历等)时触发"显示桌面",面板会先闪现一次再消失。根因有两个方面:
面板闪现:
showdesktop.qml的onClicked处理器在调用Applet.toggleShowDesktop()前未通过Panel.requestClosePopup()关闭当前弹窗。由于弹窗是 dock 面板窗口的 transient 子窗口,treeland 在处理显示桌面时会短暂改变其可见性,导致闪现。其他所有 dock 交互路径(空白区域点击、位置变化、右键菜单)都已调用Panel.requestClosePopup(),此路径遗漏了。状态失步:
treelandshowdesktop.cpp的desktopToggle()使用合成器回调更新的m_desktopState决定切换方向。当桌面上无窗口时,合成器报告的状态可能与用户意图不同步,导致第一次切换无效果,需要再次切换。修复方案
showdesktop.qml的onClicked中调用Applet.toggleShowDesktop()前添加Panel.requestClosePopup(),与其他 dock 交互路径保持一致。TreelandShowDesktop中新增m_requestedState成员变量追踪用户意图状态。desktopToggle()基于m_requestedState而非m_desktopState决定切换方向,m_desktopState仍由合成器回调更新但不影响切换决策。改动安全评估
代码安全评估
m_desktopState仍由合成器回调维护用于状态报告,仅切换决策逻辑转移到m_requestedState,对外部观察者保持既有行为。业务影响范围
验证建议
PMS: BUG-379453
Summary by Sourcery
Bug Fixes: