Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee 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 |
Reviewer's GuideImplementationTrack and replay XWayland configure requests while the surface item is hidden, preserving the correct position and resize behavior on replay.
Separate client-originated implicit-position updates from compositor-driven moves so compositor moves configure XWayland, and prevent proxy wrappers from resizing the shared surface.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/surface/surfacewrapper.cpp" line_range="558" />
<code_context>
[this, xwaylandSurfaceItem]() {
- if (m_xwaylandPositionFromSurface)
+ if (m_xwaylandPositionFromSurface) {
+ QScopedValueRollback<bool> guard(m_applyingXwaylandImplicitPosition, true);
moveNormalGeometryInOutput(xwaylandSurfaceItem->implicitPosition());
+ }
</code_context>
<issue_to_address>
**Client moves get echoed back**
When an inbound XWayland position update retargets an active geometry animation, `QScopedValueRollback` restores `m_applyingXwaylandImplicitPosition` when the handler returns, before `m_geometryAnimation` changes `x` or `y`; the change signals then call `moveTo(..., true)` and send intermediate compositor positions to XWayland instead of preserving the client-requested position.
Keep inbound-position suppression active for animation-driven `x`/`y` changes, not just while setting the animation target.
Also at `src/surface/surfacewrapper.cpp:583`.
</issue_to_address>
### Comment 2
<location path="waylib/src/server/qtquick/wxwaylandsurfaceitem.cpp" line_range="39-40" />
<code_context>
+ if (!q->xwaylandSurface())
return;
+ if (!q->isVisible()) {
+ if (positionConfigured || hasExplicitSize) {
+ pendingConfigure = true;
+ if (hasExplicitSize)
+ pendingConfigureSize = newGeometry.size();
</code_context>
<issue_to_address>
**Accepted requests get no configure**
When a hidden, not-yet-position-configured XWayland item receives an accepted position-only request or a configure request without an explicit size, `configureSurface()` leaves `pendingConfigure` false because neither `positionConfigured` nor `hasExplicitSize` is true; `itemChange()` then skips replaying the request when the item becomes visible, so the client receives no configure notification.
Set `pendingConfigure` for every accepted configure request received while the item is hidden.
</issue_to_address>
### Comment 3
<location path="waylib/src/server/qtquick/wxwaylandsurfaceitem.cpp" line_range="42" />
<code_context>
+ if (positionConfigured || hasExplicitSize) {
+ pendingConfigure = true;
+ if (hasExplicitSize)
+ pendingConfigureSize = newGeometry.size();
+ }
+ return;
</code_context>
<issue_to_address>
**Hidden configure replays stale size**
When a hidden item has an explicit-size configure pending and then receives a configure with a newer expected size but no explicit size, `pendingConfigureSize` retains the earlier size, and `itemChange()` prefers it over `expectSurfaceSize()` when replaying the configure; the X11 window therefore receives the stale size.
Update `pendingConfigureSize` to the latest expected size when handling each hidden configure, including those without an explicit size.
</issue_to_address>
### Comment 4
<location path="waylib/src/server/qtquick/wxwaylandsurfaceitem.cpp" line_range="39-43" />
<code_context>
+ if (!q->xwaylandSurface())
return;
+ if (!q->isVisible()) {
+ if (positionConfigured || hasExplicitSize) {
+ pendingConfigure = true;
+ if (hasExplicitSize)
+ pendingConfigureSize = newGeometry.size();
+ }
+ return;
+ }
</code_context>
<issue_to_address>
**Hidden proxy resize can reset X11 position**
When a hidden proxy item receives an explicit resize and is later shown, when a hidden proxy item receives an explicit resize before becoming visible, `hasExplicitSize` sets `pendingConfigure` even though `positionConfigured` is false. The visibility handler then configures the shared XWayland surface using the proxy’s `explicitSurfacePosition()`, which is not synchronized by the non-proxy-only position connections, so the real window receives the proxy’s stale position.
Do not replay a proxy’s explicit-size configure with its own position; keep the real surface position when replaying size-only updates or exclude proxy items from configure replay.
</issue_to_address>
### Comment 5
<location path="src/surface/surfacewrapper.cpp" line_range="583" />
<code_context>
connect(this, &QQuickItem::xChanged, xwaylandSurface, [this, xwaylandSurfaceItem]() {
- xwaylandSurfaceItem->moveTo(position(), !m_xwaylandPositionFromSurface);
+ xwaylandSurfaceItem->moveTo(position(), !m_applyingXwaylandImplicitPosition);
});
</code_context>
<issue_to_address>
**Diagonal moves send intermediate coordinates**
When a compositor-driven move changes both x and y, a compositor move that changes both axes invokes both callbacks, and each calls `moveTo()` with configuration enabled. `WXWaylandSurfaceItem::updatePosition()` therefore sends one configure with the new first-axis coordinate and stale second-axis coordinate, then another with the final position; Xwayland clients receive an unnecessary intermediate position.
Coalesce axis changes and configure Xwayland once with the completed position update.
Also at `src/surface/surfacewrapper.cpp:588`.
</issue_to_address>
### Comment 6
<location path="src/surface/surfacewrapper.cpp" line_range="583" />
<code_context>
connect(this, &QQuickItem::xChanged, xwaylandSurface, [this, xwaylandSurfaceItem]() {
- xwaylandSurfaceItem->moveTo(position(), !m_xwaylandPositionFromSurface);
+ xwaylandSurfaceItem->moveTo(position(), !m_applyingXwaylandImplicitPosition);
});
</code_context>
<issue_to_address>
**Example keeps stale move behavior**
When the tinywl example handles a compositor-driven XWayland move while `m_xwaylandPositionFromSurface` is true, the tinywl example retains the old `!m_xwaylandPositionFromSurface` gating, so compositor-driven moves there still move only the QtQuick item and leave the X11 window at its old coordinates.
Apply the same inbound-update guard distinction to the tinywl example's XWayland position handlers.
</issue_to_address>
### Comment 7
<location path="src/surface/surfacewrapper.cpp" line_range="583" />
<code_context>
connect(this, &QQuickItem::xChanged, xwaylandSurface, [this, xwaylandSurfaceItem]() {
- xwaylandSurfaceItem->moveTo(position(), !m_xwaylandPositionFromSurface);
+ xwaylandSurfaceItem->moveTo(position(), !m_applyingXwaylandImplicitPosition);
});
</code_context>
<issue_to_address>
**X11 configure behavior lacks wire tests**
When compositor-driven movement or visibility restoration triggers the new configure paths, `moveTo()` and the visibility-restoration path call `WXWaylandSurface::configure()`, which sends XWayland configure notifications, but the change adds no protocol-wire test for either path. Regressions in compositor-driven X11 position synchronization therefore go undetected.
Add a test that observes the resulting X11 configure/position behavior on the wire for compositor-driven moves and deferred configure replay.
Also at `waylib/src/server/qtquick/wxwaylandsurfaceitem.cpp:287`.
</issue_to_address>There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
SurfaceWrapper::setup() previously passed `!m_xwaylandPositionFromSurface` as `configSurface` to `WXWaylandSurfaceItem::moveTo()`, and `m_xwaylandPositionFromSurface` defaults to true (and is restored to true after interactive move/resize and animations). Consequently, any compositor-driven move that does not toggle `m_xwaylandPositionFromSurface` — such as `RootSurfaceContainer::moveSurfacesToOutput()` when unplugging an external screen, `ensureSurfaceNormalPositionValid()`, output layout clamping, or state geometry updates — moved only the QtQuick item while leaving the X11 window at stale off-screen coordinates, causing pointer hit-testing in Xwayland to hit the root window (X cursor, no mouse input). In addition, `WXWaylandSurfaceItemPrivate::configureSurface()` dropped configure requests whenever `!q->isVisible()` without replaying them when the item became visible again. 1. Track client-initiated position updates separately in `SurfaceWrapper` (and sync the `tinywl` example `SurfaceWrapper`) via `m_applyingXwaylandImplicitPosition` (using `QScopedValueRollback` when applying `implicitPosition`), while keeping `m_xwaylandPositionFromSurface` for inbound `implicitPositionChanged` gating. All other `xChanged`/ `yChanged` updates now pass `configSurface = true` to `WXWaylandSurfaceItem::moveTo()`. 2. Track `pendingConfigure` / `pendingConfigureSize` in `WXWaylandSurfaceItem` (guarded by `positionConfigured || hasExplicitSize`; clearing `pendingConfigureSize` on non-`ManualResize` position-only updates so dynamic resize modes recompute on replay) and replay the pending configure when `ItemVisibleHasChanged` transitions to visible. 3. Add `configurePosition()` in `WXWaylandSurfaceItemPrivate` so `doResizeSurface()` and replay fall back to `xwaylandSurface()->geometry().topLeft()` when `!positionConfigured`, and guard `SurfaceWrapper::resize()` against `m_isProxy` so proxy wrappers never resize or overwrite the shared X11 window's position. fix(xwayland): 在合成器主动移动窗口时同步 X11 窗口坐标 此前 `SurfaceWrapper::setup()` 在 `xChanged`/`yChanged` 中向 `WXWaylandSurfaceItem::moveTo()` 传入 `!m_xwaylandPositionFromSurface`,而 `m_xwaylandPositionFromSurface` 默认为 true 并在拖拽/动画结束后复位为 true。 这导致合成器主动发起但未显式关闭该标记的移动(如拔掉外接屏时 `RootSurfaceContainer::moveSurfacesToOutput()`、边界约束 `ensureSurfaceNormalPositionValid()`、输出布局重排及最大化/全屏/平铺几 何更新)只移动了 QtQuick 项位置而没有向 Xwayland 发送 `configure`,X11 窗口坐标仍留在已移除屏幕区域外,导致鼠标命中 root 窗口(光标变为 X 号且 鼠标事件失效)。 此外,`WXWaylandSurfaceItemPrivate::configureSurface()` 在 item 不可见时 直接丢弃 configure 请求,窗口恢复可见后也不会补发。 1. 在 `SurfaceWrapper`(并同步至 `tinywl` 示例的 `SurfaceWrapper`)中新增 `m_applyingXwaylandImplicitPosition`(仅在应用来自客户端的 `implicitPosition` 时通过 `QScopedValueRollback` 置位),保留 `m_xwaylandPositionFromSurface` 控制入向同步,使所有合成器主动移动都会 向 `WXWaylandSurfaceItem::moveTo()` 传入 `configSurface = true`。 2. 在 `WXWaylandSurfaceItem` 中记录不可见期间被跳过的 `pendingConfigure` / `pendingConfigureSize`(仅当 `positionConfigured` 或存在显式尺寸更新时记录;在非 `ManualResize` 下收到仅位置更新时清空 旧的 `pendingConfigureSize` 以便可见时按最新期望尺寸重算),并在 `ItemVisibleHasChanged` 变为可见时补发 `configure`。 3. 新增 `WXWaylandSurfaceItemPrivate::configurePosition()`,在 `!positionConfigured` 时由 `doResizeSurface()` 与补发路径回退到 `xwaylandSurface()->geometry().topLeft()`,并在 `SurfaceWrapper::resize()` 中拦截 `m_isProxy`,防止代理 wrapper 通过 共享 surface 覆盖或篡改真实 X11 窗口尺寸与坐标。 Log: 修复双屏拔掉外接屏等合成器移动 X11 窗口后 X11 坐标未同步导致鼠标事件失效的问题 Influence: X11 窗口在多屏拔插、边界修正、布局重排及隐藏后恢复显示时均可正确同步 X11 坐标与指针命中,且代理窗口不会覆盖真实窗口坐标

SurfaceWrapper::setup() previously passed
!m_xwaylandPositionFromSurfaceas
configSurfacetoWXWaylandSurfaceItem::moveTo(), andm_xwaylandPositionFromSurfacedefaults to true (and is restored to trueafter interactive move/resize and animations). Consequently, any
compositor-driven move that does not toggle
m_xwaylandPositionFromSurface— such as
RootSurfaceContainer::moveSurfacesToOutput()when unplugging anexternal screen,
ensureSurfaceNormalPositionValid(), output layoutclamping, or state geometry updates — moved only the QtQuick item while
leaving the X11 window at stale off-screen coordinates, causing pointer
hit-testing in Xwayland to hit the root window (X cursor, no mouse input).
In addition,
WXWaylandSurfaceItemPrivate::configureSurface()droppedconfigure requests whenever
!q->isVisible()without replaying them whenthe item became visible again.
SurfaceWrappervia
m_applyingXwaylandImplicitPosition(usingQScopedValueRollbackwhen applying
implicitPosition), while keepingm_xwaylandPositionFromSurfacefor inboundimplicitPositionChangedgating. All other
xChanged/yChangedupdates now passconfigSurface = truetoWXWaylandSurfaceItem::moveTo().pendingConfigure/pendingConfigureSizeinWXWaylandSurfaceItem(guarded bypositionConfigured || hasExplicitSizeso hidden proxy items do not overwrite the real X11 window position) and
replay the pending configure when
ItemVisibleHasChangedtransitions tovisible.
fix(xwayland): 在合成器主动移动窗口时同步 X11 窗口坐标
此前
SurfaceWrapper::setup()在xChanged/yChanged中向WXWaylandSurfaceItem::moveTo()传入!m_xwaylandPositionFromSurface,而m_xwaylandPositionFromSurface默认为 true 并在拖拽/动画结束后复位为 true。这导致合成器主动发起但未显式关闭该标记的移动(如拔掉外接屏时
RootSurfaceContainer::moveSurfacesToOutput()、边界约束ensureSurfaceNormalPositionValid()、输出布局重排及最大化/全屏/平铺几何更新)只移动了 QtQuick 项位置而没有向 Xwayland 发送
configure,X11窗口坐标仍留在已移除屏幕区域外,导致鼠标命中 root 窗口(光标变为 X 号且
鼠标事件失效)。
此外,
WXWaylandSurfaceItemPrivate::configureSurface()在 item 不可见时直接丢弃 configure 请求,窗口恢复可见后也不会补发。
SurfaceWrapper中新增m_applyingXwaylandImplicitPosition(仅在应用来自客户端的
implicitPosition时通过QScopedValueRollback置位),保留
m_xwaylandPositionFromSurface控制入向同步,使所有合成器主动移动都会向
WXWaylandSurfaceItem::moveTo()传入configSurface = true。WXWaylandSurfaceItem中记录不可见期间被跳过的pendingConfigure/pendingConfigureSize(仅当positionConfigured或存在显式尺寸更新时记录,避免隐藏的代理 item 在可见时覆盖真实窗口坐
标),并在
ItemVisibleHasChanged变为可见时补发configure。Log: 修复双屏拔掉外接屏等合成器移动 X11 窗口后 X11 坐标未同步导致鼠标事件失效的问题
Influence: X11 窗口在多屏拔插、边界修正、布局重排及隐藏后恢复显示时均可正确同步 X11 坐标与指针命中
Summary by Sourcery
Keep XWayland window geometry synchronized during compositor moves and visibility changes.
Bug Fixes: