Skip to content

Minor fixes for Xwayland apps - #1199

Closed
LFRon wants to merge 2 commits into
linuxdeepin:masterfrom
LFRon:fix/xwayland
Closed

Minor fixes for Xwayland apps#1199
LFRon wants to merge 2 commits into
linuxdeepin:masterfrom
LFRon:fix/xwayland

Conversation

@LFRon

@LFRon LFRon commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

本人试着对Xwayland应用做的一些修复

@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, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@LFRon
LFRon marked this pull request as ready for review July 23, 2026 14:03
@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

@LFRon
LFRon marked this pull request as draft July 23, 2026 14:03
@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 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

该PR的几个提交用途如下: (该评论会随着commit更新而更新)

0b6dc89 用于修复Xwayland应用无法正常最大化的问题,顺带修掉Electron应用在纯Wayland环境下也有的这个问题 (已证明引起微信行为异常)

697d0e0 用于修复Xwayland应用显示层级问题 (例如你开着QQ窗口,然后打开微信,不论光标行为还是键盘输入都会直接穿透到QQ父窗口而不是微信上)

@LFRon
LFRon marked this pull request as ready for review July 24, 2026 03:35

@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, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-bot

deepin-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.16
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1203

@LFRon
LFRon force-pushed the fix/xwayland branch 2 times, most recently from 697d0e0 to 7e030ca Compare July 24, 2026 04:47
@wineee
wineee requested a review from Copilot July 24, 2026 06:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

EN: This PR targets “minor fixes for XWayland apps” by improving launch-time state/geometry negotiation (especially initial maximize), making resize/configure behavior more explicit when surfaces/items are hidden, and moving initial XDG toplevel configure scheduling into the protocol layer so it doesn’t depend on QtQuick item creation timing.

中文:该 PR 主要针对 XWayland 应用在启动阶段的状态/几何协商问题(尤其是首次最大化),显式化隐藏状态下的 resize/configure 行为,并将 XDG toplevel 的 initial configure 调整到协议层触发,避免依赖 QtQuick Item 创建时序。

Changes:

  • EN: Add an explicit “configure while hidden” path for XWayland surface items and propagate resize success/failure.
    中文:为 XWayland surface item 增加“隐藏时仍可 configure”的路径,并将 resize 是否真正发出 configure 的结果向上返回。
  • EN: Introduce “maximize requested” APIs for XWayland/XDG toplevel surfaces and wire initial XDG maximize configuration through ShellHandler (including deferred adoption when wrapper creation is async).
    中文:为 XWayland/XDG toplevel 增加“客户端请求最大化”读取接口,并在 ShellHandler 中配置/延后应用 XDG 的初始最大化(适配 wrapper 异步创建)。
  • EN: Improve prelaunch/restore-size retention and normal-geometry capture to avoid persisting invalid sizes (e.g., maximized presentation geometry).
    中文:改进 prelaunch 恢复尺寸保留与 normal geometry 捕获逻辑,避免持久化错误尺寸(例如最大化展示尺寸)。

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
waylib/src/server/qtquick/wxwaylandsurfaceitem.h Adds API to configure XWayland surface even when hidden (single-call bypass).
waylib/src/server/qtquick/wxwaylandsurfaceitem.cpp Makes hidden configure return failure unless explicitly allowed; implements configureSurfaceWhileHidden().
waylib/src/server/qtquick/wxdgtoplevelsurfaceitem.cpp Removes initial-commit configure from QtQuick item path (moved to protocol layer).
waylib/src/server/protocols/wxwaylandsurface.h Adds isMaximizeRequested() API (requested state vs compositor-ack state).
waylib/src/server/protocols/wxwaylandsurface.cpp Uses wrapper helper is_maximized() and exposes requested-maximize query.
waylib/src/server/protocols/wxdgtoplevelsurface.h Adds requested-maximize query and initialConfigureRequested() signal.
waylib/src/server/protocols/wxdgtoplevelsurface.cpp Schedules initial configure on initial commit; updates request-state checks; adds categorized logging.
src/surface/surfacewrapper.h Adds normal-geometry source tracking, deferred state machinery, and initial-maximize orchestration APIs/state.
src/surface/surfacewrapper.cpp Implements initial maximize negotiation (XWayland + XDG), deferred state transitions, and robust normal-geometry capture.
src/core/shellhandler.h Adds unmatched-prelaunch retention bookkeeping and initial XDG maximize configuration plumbing.
src/core/shellhandler.cpp Implements retention of restore-size across prelaunch mismatch and initial XDG maximize configure/cancel flows.
qwlroots/src/types/qwxwaylandsurface.h Adds is_maximized() convenience accessor for XWayland surface state bits.
qwlroots/src/types/qwxdgshell.h Adds inline helpers for initial commit and requested states on xdg_toplevel.

Comment thread src/core/shellhandler.cpp
@LFRon

LFRon commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

只有这一个建议嘛(

@LFRon
LFRon marked this pull request as draft July 24, 2026 08:03
@LFRon
LFRon force-pushed the fix/xwayland branch 5 times, most recently from 6a18bc7 to d436773 Compare July 24, 2026 10:40
@LFRon
LFRon marked this pull request as ready for review July 24, 2026 10:40

@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, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@LFRon

LFRon commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

该PR涵盖以下修复:

  1. 修复当另一个Xwayland应用显示在前一个Xwayland应用的父界面时, 会导致键盘/鼠标行为穿透到父应用内: d436773
  2. 修复Wayland/Xwayland应用申请最大化时, 应用以为自己最大化了但实际上没有: 2bb7ae0

LFRon added 2 commits July 28, 2026 18:10
XWayland and XDG clients can request maximization before Treeland has
created or exposed a SurfaceWrapper. Handling that request only after
map leaves the client and compositor state out of sync, or produces a
visible second maximize transition after the window is presented.

For XDG toplevels, notify Treeland synchronously from Waylib's initial
empty commit after scheduling the default 0x0 configure. ShellHandler
selects the output work area and folds the size and maximized state into
wlroots' pending initial configure. Carry the accepted geometry across
asynchronous AppId and prelaunch wrapper creation, adopt it without a
second configure or animation, and reveal the client after a matching
buffer is committed.

Keep XWayland's post-map hidden configure path. Preserve only reliable
normal geometry for restore and persistence, replay state changes
deferred during launch transitions, and retain a 1500 ms presentation
timeout so an unresponsive client cannot remain hidden indefinitely.

Expose the required request-state helpers through qwlroots and Waylib,
and report hidden XWayland configure failure instead of treating it as
success.

Log: 修复XWayland及原生Wayland应用启动时请求最大化但窗口未正确最大化的问题
Influence: XWayland/XDG窗口初始最大化协商、预启动Splash交接及窗口化尺寸恢复
Prelaunch wrappers can already be active when their managed XWayland surface is attached. Because the activated wrapper does not change, the normal activation path does not raise the new native X11 window. Treeland then reports the app as active while X11 input can remain stacked behind another window.

Before exposing the real surface, raise both the Treeland item and native X11 window. Limit this to active managed surfaces so inactive and override-redirect windows are unaffected.

Log: 修复XWayland预启动窗口切换后点击穿透的问题

Influence: XWayland预启动Splash切换到真实窗口时的堆叠顺序
@zzxyb

zzxyb commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@LFRon [fix(xwayland): sync active prelaunch stacking on handoff]看着能更快合入,可否拆分为两个PR?

@zzxyb
zzxyb self-requested a review July 28, 2026 11:58
@LFRon

LFRon commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@LFRon [fix(xwayland): sync active prelaunch stacking on handoff]看着能更快合入,可否拆分为两个PR?

可以的, 我明天试试

@deepin-bot

deepin-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.17
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1229

@LFRon
LFRon marked this pull request as draft August 3, 2026 03:55
@deepin-bot

deepin-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.18
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1286

@deepin-bot

deepin-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.9.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1312

@LFRon

LFRon commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

该PR意义不大了,故先关闭

@LFRon LFRon closed this Aug 22, 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.

4 participants