fix: handle XWayland transient resize and parent association#1033
Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
Reviewer's GuideEnsures XWayland transient surfaces only reparent once their Wayland parent is known, and applies XWayland configure-request sizes directly to the wrapper geometry while preventing recursive resize feedback, plus exposes parent surfaces and explicit geometry configuration hooks for XWayland surfaces/items. Sequence diagram for XWayland configure-request driven resizesequenceDiagram
participant WXWaylandSurface
participant SurfaceWrapper
participant WXWaylandSurfaceItem
WXWaylandSurface->>SurfaceWrapper: requestConfigure(flags)
SurfaceWrapper->>SurfaceWrapper: [flags has XCB_CONFIG_WINDOW_SIZE]
SurfaceWrapper->>SurfaceWrapper: updateSurfaceSizeRatio()
SurfaceWrapper->>WXWaylandSurface: requestConfigureGeometry()
WXWaylandSurface-->>SurfaceWrapper: requestGeometry
SurfaceWrapper->>WXWaylandSurface: geometry()
WXWaylandSurface-->>SurfaceWrapper: currentBufferSize
SurfaceWrapper->>WXWaylandSurfaceItem: surfaceSizeRatio()
WXWaylandSurfaceItem-->>SurfaceWrapper: surfaceSizeRatio
SurfaceWrapper->>SurfaceWrapper: compute requestedSceneSize
SurfaceWrapper->>SurfaceWrapper: setNormalGeometry(requestedNormalGeometry)
SurfaceWrapper->>SurfaceWrapper: [isNormal && !m_geometryAnimation]
SurfaceWrapper->>SurfaceWrapper: m_applyingXwaylandConfigureRequestSize = true
SurfaceWrapper->>SurfaceWrapper: setSize(requestedSceneSize)
SurfaceWrapper->>SurfaceWrapper: m_applyingXwaylandConfigureRequestSize = false
SurfaceWrapper->>WXWaylandSurfaceItem: configureSurfaceGeometry(configureGeometry)
SurfaceWrapper->>SurfaceWrapper: geometryChange(newGeo, oldGeo)
SurfaceWrapper->>SurfaceWrapper: [widthValid && heightValid && !m_applyingXwaylandConfigureRequestSize]
SurfaceWrapper->>SurfaceWrapper: resize(newGeometry.size())
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 left some high level feedback:
- The XWayland
requestConfigurehandling lambda insideSurfaceWrapper::setuphas grown quite complex (size-ratio computations, early returns, geometry updates, recursive guards); consider extracting it into a dedicated member function to improve readability and make future changes less error-prone. - In
WXWaylandSurfacePrivate::updateParent,parentSurfaceChangedcan now be emitted both explicitly (whenoldParentSurface != newParentSurface) and via the new connection to the parent’ssurfaceChangedsignal; double-check whether this can lead to duplicate notifications for listeners and whether you want to centralize that emission in one place.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The XWayland `requestConfigure` handling lambda inside `SurfaceWrapper::setup` has grown quite complex (size-ratio computations, early returns, geometry updates, recursive guards); consider extracting it into a dedicated member function to improve readability and make future changes less error-prone.
- In `WXWaylandSurfacePrivate::updateParent`, `parentSurfaceChanged` can now be emitted both explicitly (when `oldParentSurface != newParentSurface`) and via the new connection to the parent’s `surfaceChanged` signal; double-check whether this can lead to duplicate notifications for listeners and whether you want to centralize that emission in one place.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
TAG Bot New tag: 0.8.12 |
408e166 to
da22ee0
Compare
zccrs
left a comment
There was a problem hiding this comment.
看代码改了很多,不过应该不全是有效代码。这个问题的根因是啥?光看代码没看出来改动逻辑是什么。
| [this, xwaylandSurfaceItem]() { | ||
| const QPointF implicitPosition = xwaylandSurfaceItem->implicitPosition(); | ||
| if (m_xwaylandPositionFromSurface) | ||
| moveNormalGeometryInOutput(xwaylandSurfaceItem->implicitPosition()); |
| moveNormalGeometryInOutput(implicitPosition); | ||
| }); | ||
|
|
||
| connect(xwaylandSurface, |
There was a problem hiding this comment.
为什么会单独连接它?有requestConfigure时就会触发 &WXWaylandSurfaceItem::implicitPositionChanged 和 WSurfaceItem::implicitWidthChanged 和 WSurfaceItem::implicitHeightChanged
4d69145 to
9fbf966
Compare
|
TAG Bot New tag: 0.8.13 |
3a68039 to
97f8be9
Compare
VirtualBox 菜单瞬间关闭的根因不是动画,也不是菜单 surface 本身坏了,而是 XWayland override-redirect 菜单弹出时,鼠标按钮还按着,treeland 让 pointer focus 立刻从原窗口切到新菜单 surface。wlroots 在 pointer focus surface 变化时会 reset_buttons(),也就是把 button_count 清零。随后释放鼠标时,release 和 press 的状态链断了,VBox 就像收到了一次菜单项选择/关闭,于是菜单刚出现就关闭。 然后关于 requestConfigure:质疑方向是对的,代码确实显得绕。但按当前代码,不能简单删掉 SurfaceWrapper 里对 WXWaylandSurface::requestConfigure 的处理,因为 SurfaceWrapper 把 m_surfaceItem 设成了 ManualResize,WXWaylandSurfaceItem 的 requestConfigure 连接目前只在 position mask 时发 implicitPositionChanged,并不会自动把 wrapper 的 actual size / normalGeometry 改掉。这个 handler 的作用是处理 mapped XWayland 的 size configure request,并回 configure() 给 XWayland。 然后GPT-5.5确实承认了多改了代码, 我等下force-push上来 ( |
97f8be9 to
bbf6ae1
Compare
XWayland override-redirect transients and mapped X11 configure flows can arrive before treeland has a wrapper/container ready. Focus or pointer transitions during the opening click also let wlroots reset pointer button state, so dialogs and menus from apps such as WeChat and VirtualBox could close immediately after appearing. Forward wlroots focus_in/grab_focus through qwlroots and waylib, defer override-redirect focus until the surface is mapped, and apply it only when wlroots reports the surface wants keyboard focus. Defer pointer enter/clear while buttons are held so the click that opens a popup is not converted into an unintended release/activation. Wait for parent association before reparenting XWayland children, accept mapped ConfigureRequest sizes for managed XWayland windows, guard recursive resize feedback, and sync the accepted content size after X11 configure to avoid transient main-window artifacts. Keep the remaining debug output focused on the core deferred/applied/dropped decisions.
bbf6ae1 to
8920e96
Compare
|
修不好, 微信搜索框的光标一直失焦, 不失焦就在截图后直接无法聚焦搜索框本体, 先关了这个PR |
该PR用于修复两个连锁问题: 1. 微信左上角搜索框打开之后立刻消失 2. 我用GPT-5.5让微信搜索框能显示后窗口大小不能改变
Ensure XWayland transient surfaces wait for parent Wayland surface association before being reparented, avoiding premature fallback to the workspace container.
Apply mapped XWayland configure request sizes directly to the wrapper geometry so override-redirect dialog surfaces can receive their requested height on first show. Guard the geometry-change resize path to avoid feeding the same configure size back recursively.
Also expose XWayland parent surfaces through WToplevelSurface and add an explicit geometry configure entry point for XWayland surface items.
Summary by Sourcery
Fix XWayland transient dialog parenting and resize handling to keep transient windows attached to their parents and respect their requested sizes without recursive configure loops.
Bug Fixes:
Enhancements: