Skip to content

fix: xwayland apps dialog popup (部分Xwayland应用弹窗问题)#1173

Open
LFRon wants to merge 3 commits into
linuxdeepin:masterfrom
LFRon:fix/xwayland-dialog-popup
Open

fix: xwayland apps dialog popup (部分Xwayland应用弹窗问题)#1173
LFRon wants to merge 3 commits into
linuxdeepin:masterfrom
LFRon:fix/xwayland-dialog-popup

Conversation

@LFRon

@LFRon LFRon commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

该PR修复了三个问题:

  1. VirtualBox顶栏工具栏不仅弹出就退出, 而且会以为你同时按下了菜单内选项而误打开, 且容易引发treeland崩溃
  2. 微信左上角顶栏的搜索栏无法正确打开, 打开即关闭, 包括@他人也是这样
  3. 东方财富右上角搜索栏的对话框点击打开即退出

该PR我力竭了修不好的问题:
东方财富按开设置页面再关闭后,搜索框弹出的对话框只能用键盘选中,无法用鼠标选中,且再按关闭键也是一样的问题(关闭界面弹出的对话框鼠标光标点击是穿透的只能用键盘控制)

该PR为了修好应用此PR导致微信表情框穿透的问题, 因而改动了wlroots, 恳请大佬们改进(

LFRon added 3 commits July 18, 2026 16:12
XWayland Qt applications may create transient utility/tooltip/menu
windows with different ICCCM input models and override-redirect states.
Previously treeland treated some of them like normal toplevels, so mouse
events could pass through to the parent window, popup focus could be
stolen/restored at the wrong time, and destroying a short-lived child
popup could emit a fake parent change that moved it into Workspace and
triggered an assert.

Fix this by:
- tracking XWayland popup-like transient policy on SurfaceWrapper
- routing bypass/override-redirect child popups to PopupContainer while
  keeping managed transients with their parent container
- redirecting pointer events to the real popup target and tracking the
  popup pointer owner during press/release
- using XWayland native focus/WM_TAKE_FOCUS according to the input model
  and restoring parent focus after popup teardown
- cleaning cached XWayland parent/children relations before destroy with
  QPointer, without reporting a destroy-time reparent as a real parent
  change
- dropping stale async property replies and container updates for
  dissociated XWayland surfaces
- adding focused XWayland diagnostics for popup routing, focus, pointer
  delivery, size ratio and tree cleanup

This fixes XWayland Qt5/Qt6 search dialogs that closed immediately,
lost focus, received no mouse input, or crashed treeland when short-lived
popup children were destroyed.

Tested with:
- cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr
- ninja -C build
- ctest --test-dir build --output-on-failure
Some Qt Xwayland applications create popup-like windows as managed
NET_WM_WINDOW_TYPE_NORMAL/UTILITY transients instead of override-redirect
menus. These windows need to stay visually and logically attached to their
parent, otherwise pointer events may be delivered to the parent window while
the popup is still rendered above it.

Handle these popup-like Xwayland transients more explicitly:

- classify managed Xwayland transient utility/normal windows as popup-like
  surfaces and keep their size/animation policy separate from normal windows
- route managed popup-like transients through their parent container when a
  real parent wrapper is available, and synchronize QtQuick/X11 stacking
  above the parent instead of always using the global popup container
- resolve transient parents through the native X11 parent tree when
  WM_TRANSIENT_FOR points to an intermediate unmanaged X window
- track per-seat popup pointer ownership, opening guards and button
  sequences so press/move/release events stay with the popup that owns the
  interaction
- add explicit pointer redirection support in WSeat for Xwayland popup
  recovery paths
- keep popup mouse activation pointer-only and restore/keep parent focus when
  the popup should not steal normal keyboard focus
- add categorized Xwayland diagnostics for parent resolution, hit testing,
  pointer ownership, focus decisions and redirect paths
Some Qt XWayland applications use managed NORMAL or UTILITY transients for popup dialogs. Treat these surfaces as popup-like windows, resolve their native transient parents, and keep scene and X11 stacking synchronized with the parent. Use request geometry for surface-sized popups while preserving compositor-managed toplevel geometry.

Track popup pointer ownership per seat and keep each button sequence bound to its originating XWayland client. If a popup unmaps during a press, deliver the balancing release through a mapped surface of that client and synchronize Waylib's cached event target with the wlroots pointer focus.

Extend XWM focus bookkeeping so Treeland can offer or force native focus when a transient closes. Defer the parent focus refresh until the popup has unmapped and the button sequence has completed, coalesce repeated activation requests, and validate the seat and parent before refreshing. This restores subsequent popup activation without allowing focus feedback to spin the compositor.

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

Sorry @LFRon, your pull request is larger than the review limit of 150000 diff characters

@LFRon LFRon changed the title fix: xwayland dialog popup (Xwayland应用弹窗问题) fix: xwayland apps dialog popup (Xwayland应用弹窗问题) Jul 18, 2026
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LFRon

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

@LFRon LFRon changed the title fix: xwayland apps dialog popup (Xwayland应用弹窗问题) fix: xwayland apps dialog popup (部分Xwayland应用弹窗问题) Jul 18, 2026
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