Skip to content

fix: add showingDesktop signal monitoring in WaylandDockHelper - #1775

Open
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/pms-bug-bot/6480572abdd1
Open

MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/pms-bug-bot/6480572abdd1

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

fix: add showingDesktop signal monitoring in WaylandDockHelper

  1. Root cause: WaylandDockHelper lacked KWin DBus showingDesktopChanged
    signal monitoring, unlike X11DockHelper which already had it. When
    Win+D triggered show-desktop, the dock panel popup was not proactively
    closed, causing a flash before disappearing and missed toggles
  2. Fix: mirror X11DockHelper by adding setupKWinDBusConnection() to
    connect org.kde.KWin showingDesktopChanged signal, and
    onShowingDesktopChanged() to call requestClosePopup() when showing
    is true, plus m_showingDesktop state tracking in isWindowOverlap()
  3. Impact: only affects Wayland session dock panel popup behavior on
    show-desktop, no change to X11 path or normal popup display logic

Log: Fix dock panel popup flash on show-desktop in Wayland session

Influence:

  1. Test Win+D show-desktop with a tray plugin panel open in Wayland
  2. Verify no flash appears and panel closes immediately
  3. Test consecutive Win+D toggles for consistent response
  4. Verify normal popup open/close behavior is unaffected

fix: WaylandDockHelper 添加显示桌面信号监听

  1. 根因:WaylandDockHelper 缺少 KWin DBus showingDesktopChanged 信号
    监听,而 X11DockHelper 已有完整实现。Win+D 触发显示桌面时无法
    主动关闭托盘面板 popup,导致面板闪现后消失且连续操作时漏触发
  2. 方案:镜像 X11DockHelper 添加 setupKWinDBusConnection() 连接
    org.kde.KWin 的 showingDesktopChanged 信号,onShowingDesktopChanged()
    在 showing 为 true 时调用 requestClosePopup() 主动关闭面板,并在
    isWindowOverlap() 中参考 m_showingDesktop 状态
  3. 影响:仅影响 Wayland 会话下显示桌面时的 dock 面板 popup 行为,
    不影响 X11 路径及正常 popup 显示逻辑

Log: 修复 Wayland 会话下显示桌面时 dock 面板 popup 闪现问题

Influence:

  1. 测试 Wayland 会话下打开托盘插件面板后按 Win+D 显示桌面
  2. 验证面板无闪现且立即消失
  3. 测试连续 Win+D 切换显示桌面的响应一致性
  4. 验证正常 popup 打开关闭行为不受影响

PMS: BUG-380373

Summary by Sourcery

Fix Wayland dock panel popup behavior during KWin show-desktop transitions.

Bug Fixes:

  • Prevent Wayland dock panel popups from flashing or missing toggles when KWin enters show-desktop mode by monitoring the showingDesktopChanged signal and closing active popups immediately.

Enhancements:

  • Track the Wayland show-desktop state when determining dock window overlap and notify consumers when that state changes.

1. Root cause: WaylandDockHelper lacked KWin DBus showingDesktopChanged
   signal monitoring, unlike X11DockHelper which already had it. When
   Win+D triggered show-desktop, the dock panel popup was not proactively
   closed, causing a flash before disappearing and missed toggles
2. Fix: mirror X11DockHelper by adding setupKWinDBusConnection() to
   connect org.kde.KWin showingDesktopChanged signal, and
   onShowingDesktopChanged() to call requestClosePopup() when showing
   is true, plus m_showingDesktop state tracking in isWindowOverlap()
3. Impact: only affects Wayland session dock panel popup behavior on
   show-desktop, no change to X11 path or normal popup display logic

Log: Fix dock panel popup flash on show-desktop in Wayland session

Influence:
1. Test Win+D show-desktop with a tray plugin panel open in Wayland
2. Verify no flash appears and panel closes immediately
3. Test consecutive Win+D toggles for consistent response
4. Verify normal popup open/close behavior is unaffected

fix: WaylandDockHelper 添加显示桌面信号监听

1. 根因:WaylandDockHelper 缺少 KWin DBus showingDesktopChanged 信号
   监听,而 X11DockHelper 已有完整实现。Win+D 触发显示桌面时无法
   主动关闭托盘面板 popup,导致面板闪现后消失且连续操作时漏触发
2. 方案:镜像 X11DockHelper 添加 setupKWinDBusConnection() 连接
   org.kde.KWin 的 showingDesktopChanged 信号,onShowingDesktopChanged()
   在 showing 为 true 时调用 requestClosePopup() 主动关闭面板,并在
   isWindowOverlap() 中参考 m_showingDesktop 状态
3. 影响:仅影响 Wayland 会话下显示桌面时的 dock 面板 popup 行为,
   不影响 X11 路径及正常 popup 显示逻辑

Log: 修复 Wayland 会话下显示桌面时 dock 面板 popup 闪现问题

Influence:
1. 测试 Wayland 会话下打开托盘插件面板后按 Win+D 显示桌面
2. 验证面板无闪现且立即消失
3. 测试连续 Win+D 切换显示桌面的响应一致性
4. 验证正常 popup 打开关闭行为不受影响

PMS: BUG-380373
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

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

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

WaylandDockHelper now mirrors the X11 helper’s KWin D-Bus integration: it tracks show-desktop state, proactively closes the dock popup, and prevents overlap logic from reopening or retaining the popup during Win+D.

Sequence diagram for Wayland show-desktop popup closure

sequenceDiagram
    participant KWin
    participant Helper as WaylandDockHelper
    participant Panel as DockPanel

    Helper->>KWin: setupKWinDBusConnection()
    KWin-->>Helper: showingDesktopChanged(showing)
    Helper->>Helper: onShowingDesktopChanged(showing)
    alt showing
        Helper->>Panel: requestClosePopup()
        Helper->>Helper: isWindowOverlap()
    end
Loading

File-Level Changes

Change Details Files
Add KWin show-desktop state monitoring to the Wayland dock helper and close active popups immediately when desktop showing begins.
  • Initialize the desktop-showing state and register a session D-Bus listener for KWin’s showingDesktopChanged(bool) signal.
  • Read the initial KWin showingDesktop property when the interface is available.
  • Close the dock popup on transition to show-desktop and emit overlap-state updates.
  • Suppress window-overlap reporting while show-desktop is active.
panels/dock/waylanddockhelper.cpp
panels/dock/waylanddockhelper.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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.

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/waylanddockhelper.cpp" line_range="219-220" />
<code_context>
+{
+    QDBusInterface kwin("org.kde.KWin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus());
+    if (kwin.isValid()) {
+        m_showingDesktop = kwin.property("showingDesktop").toBool();
+        kwin.connection().connect("org.kde.KWin", "/KWin", "org.kde.KWin",
+                                 "showingDesktopChanged", this, SLOT(onShowingDesktopChanged(bool)));
+    }
</code_context>
<issue_to_address>
**Show-desktop state stays stale**

When KWin changes show-desktop state between the property read and signal subscription, `setupKWinDBusConnection()` misses the transition, so `m_showingDesktop` stays stale until another transition and overlap checks or popup handling use the wrong state.

Subscribe to `showingDesktopChanged` before reading the property, so transitions during setup are not missed.

Also at `panels/dock/waylanddockhelper.cpp:221`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +219 to +220
m_showingDesktop = kwin.property("showingDesktop").toBool();
kwin.connection().connect("org.kde.KWin", "/KWin", "org.kde.KWin",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Show-desktop state stays stale

When KWin changes show-desktop state between the property read and signal subscription, setupKWinDBusConnection() misses the transition, so m_showingDesktop stays stale until another transition and overlap checks or popup handling use the wrong state.

Subscribe to showingDesktopChanged before reading the property, so transitions during setup are not missed.

Also at panels/dock/waylanddockhelper.cpp:221.

Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at lines 219-220:

**Show-desktop state stays stale**

When KWin changes show-desktop state between the property read and signal subscription, `setupKWinDBusConnection()` misses the transition, so `m_showingDesktop` stays stale until another transition and overlap checks or popup handling use the wrong state.

Subscribe to `showingDesktopChanged` before reading the property, so transitions during setup are not missed.

Also at `panels/dock/waylanddockhelper.cpp:221`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants