Skip to content

fix: eliminate dxcb warnings for missing private atoms - #348

Closed
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warning-batch3
Closed

Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warning-batch3

Conversation

@Ivy233

@Ivy233 Ivy233 commented Oct 7, 2026 •

Copy link
Copy Markdown

Utility::internAtom() defaults to only_if_exists=true, so on X servers where the deepin-kwin private atom _DEEPIN_MOVE_UPDATE has not been created, the lookup returns XCB_NONE and updateMousePointForWindowMove() sends a ClientMessage with a zero type field. The window manager forwards that malformed message back to the client window, where Qt logs a confusing "Unhandled client message" warning with an empty atom name (qtbase qxcbwindow.cpp). Skip the message when the atom does not exist - the window manager would not understand it anyway.

The _NET_KDE_COMPOSITE_TOGGLING atom is KWin-private and legitimately absent on non-KWin compositors; internAtom() also returns XCB_NONE when the X connection is already broken (observed during session teardown, when the compositor releases _NET_WM_CM_S0 and triggers updateHasComposite() via the Xfixes selection notify). Both cases hit the early return in updateHasComposite() with a misleading qWarning, and worse, skipped the stage2 fallback that probes the _NET_WM_CM_S0 selection owner, leaving m_hasComposite stale on non-KWin environments. Intern the atom with only_if_exists=false so stage1 naturally falls through to stage2 when the property is unset, and keep a silent guard for genuine X connection failures.

修复 dxcb 私有 atom 缺失时的两条告警:

internAtom() 默认 only_if_exists=true,窗管未创建 _DEEPIN_MOVE_UPDATE 私有 atom 时查询返回 XCB_NONE,导致发出 type 为 0 的 ClientMessage, 被窗管转发回客户端后触发 qtbase 的 "Unhandled client message" 空名称 告警。atom 不存在时直接跳过——窗管本就无法理解该消息。

_NET_KDE_COMPOSITE_TOGGLING atom 为 KWin 私有,非 KWin 合成器下不存在 属正常情况;会话退出期 X 连接断开时(合成器释放 _NET_WM_CM_S0 经
Xfixes 通知触发 updateHasComposite())internAtom 同样返回 XCB_NONE。 两种情况都会命中 updateHasComposite() 的提前返回并打出误导性
qWarning,且跳过 stage2 的 _NET_WM_CM_S0 selection owner 回退探测, 导致非 KWin 环境下 m_hasComposite 停留在初始值。改用
only_if_exists=false intern atom,使属性未设置时 stage1 自然落入 stage2;保留对 X 连接异常的静默守卫。

PMS: TASK-394335

Summary by Sourcery

Prevent warnings and stale compositing state when private X11 atoms are missing or the X connection is unavailable.

Bug Fixes:

  • Avoid sending window-move client messages when the private atom is unavailable, preventing malformed X11 messages and related Qt warnings.
  • Handle missing compositor-specific atoms without misleading warnings while preserving fallback compositing detection and silently tolerating broken X connections.

Utility::internAtom() defaults to only_if_exists=true, so on X servers
where the deepin-kwin private atom _DEEPIN_MOVE_UPDATE has not been
created, the lookup returns XCB_NONE and updateMousePointForWindowMove()
sends a ClientMessage with a zero type field. The window manager
forwards that malformed message back to the client window, where Qt
logs a confusing "Unhandled client message" warning with an empty atom
name (qtbase qxcbwindow.cpp). Skip the message when the atom does not
exist - the window manager would not understand it anyway.

The _NET_KDE_COMPOSITE_TOGGLING atom is KWin-private and legitimately
absent on non-KWin compositors; internAtom() also returns XCB_NONE when
the X connection is already broken (observed during session teardown,
when the compositor releases _NET_WM_CM_S0 and triggers
updateHasComposite() via the Xfixes selection notify). Both cases hit
the early return in updateHasComposite() with a misleading qWarning,
and worse, skipped the stage2 fallback that probes the _NET_WM_CM_S0
selection owner, leaving m_hasComposite stale on non-KWin environments.
Intern the atom with only_if_exists=false so stage1 naturally falls
through to stage2 when the property is unset, and keep a silent guard
for genuine X connection failures.

修复 dxcb 私有 atom 缺失时的两条告警:

internAtom() 默认 only_if_exists=true,窗管未创建 _DEEPIN_MOVE_UPDATE
私有 atom 时查询返回 XCB_NONE,导致发出 type 为 0 的 ClientMessage,
被窗管转发回客户端后触发 qtbase 的 "Unhandled client message" 空名称
告警。atom 不存在时直接跳过——窗管本就无法理解该消息。

_NET_KDE_COMPOSITE_TOGGLING atom 为 KWin 私有,非 KWin 合成器下不存在
属正常情况;会话退出期 X 连接断开时(合成器释放 _NET_WM_CM_S0 经
Xfixes 通知触发 updateHasComposite())internAtom 同样返回 XCB_NONE。
两种情况都会命中 updateHasComposite() 的提前返回并打出误导性
qWarning,且跳过 stage2 的 _NET_WM_CM_S0 selection owner 回退探测,
导致非 KWin 环境下 m_hasComposite 停留在初始值。改用
only_if_exists=false intern atom,使属性未设置时 stage1 自然落入
stage2;保留对 X 连接异常的静默守卫。

PMS: TASK-394335
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ivy233

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

@sourcery-ai

sourcery-ai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR prevents zero-type X11 ClientMessages for unsupported deepin-KWin move updates and fixes compositor detection by distinguishing a legitimately missing KWin atom from X connection failure, preserving the fallback selection-owner probe.

Sequence diagram for safe window move client messages

sequenceDiagram
    participant Client
    participant DXcbWMSupport
    participant XServer
    DXcbWMSupport->>XServer: internAtom(_DEEPIN_MOVE_UPDATE)
    alt atom exists
        XServer-->>DXcbWMSupport: moveUpdateType
        DXcbWMSupport->>XServer: xcb_send_event(ClientMessage)
        XServer-->>Client: move update message
    else atom missing
        XServer-->>DXcbWMSupport: XCB_NONE
        DXcbWMSupport-->>Client: return without sending message
    end
Loading

Sequence diagram for compositor detection fallback

sequenceDiagram
    participant Xfixes
    participant DXcbWMSupport
    participant XServer
    Xfixes->>DXcbWMSupport: updateHasComposite()
    DXcbWMSupport->>XServer: internAtom(_NET_KDE_COMPOSITE_TOGGLING, false)
    alt X connection available
        XServer-->>DXcbWMSupport: atom
        DXcbWMSupport->>XServer: query _NET_KDE_COMPOSITE_TOGGLING
        alt property found
            XServer-->>DXcbWMSupport: compositor state
        else property absent
            DXcbWMSupport->>XServer: query selection owner _NET_WM_CM_S0
            XServer-->>DXcbWMSupport: compositor owner
        end
    else X connection broken
        XServer-->>DXcbWMSupport: XCB_NONE
        DXcbWMSupport-->>Xfixes: return silently
    end
Loading

File-Level Changes

Change Details Files
Avoid sending malformed client messages when the private move-update atom is unavailable.
  • Intern the move-update atom once before constructing the event.
  • Return without sending when lookup returns XCB_NONE.
  • Reuse the validated atom as the ClientMessage type.
xcb/utility_x11.cpp
Handle compositor detection correctly across non-KWin environments and X connection teardown.
  • Create the KWin-private atom when needed so an absent property can fall through to the _NET_WM_CM_S0 owner probe.
  • Silently return only when atom interning fails, indicating an unusable X connection.
  • Remove the misleading warning for a legitimately absent private atom.
xcb/dxcbwmsupport.cpp

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 reviewed your changes and they look great!


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

@deepin-bot

deepin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.51
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #349

@Ivy233 Ivy233 closed this Oct 21, 2026
@Ivy233
Ivy233 deleted the fix/dde-shell-warning-batch3 branch October 21, 2026 02:49
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.

2 participants