From 714635049e1917608efcfc579fbc1d4728c9e873 Mon Sep 17 00:00:00 2001 From: wangjinrun Date: Fri, 20 Nov 2026 10:44:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(layershell):=20decouple=20anchor=20update?= =?UTF-8?q?=20from=20size=20update=20in=20trySetAnchorsAndSize=20fix(layer?= =?UTF-8?q?shell):=20=E8=A7=A3=E8=80=A6=20trySetAnchorsAndSize=20=E4=B8=AD?= =?UTF-8?q?=E9=94=9A=E7=82=B9=E4=B8=8E=E5=B0=BA=E5=AF=B8=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Move set_anchor() outside the anchorsSizeConflict() guard so anchors are always sent to the compositor regardless of size validity. 2. Only skip set_size() when anchorsSizeConflict() returns true, keeping size protection unchanged. When m_requestSize is 0x0 (initial state before QML binding evaluation), anchorsSizeConflict() returned true and caused set_anchor() to be skipped as well, leaving the dock unanchored from the screen edge. This made the taskbar appear floating after new user login on Treeland/Wayland. 当 m_requestSize 为 0x0(QML 绑定求值前的初始状态)时, anchorsSizeConflict() 返回 true 导致 set_anchor() 也被跳过, 任务栏锚点无法修正,新用户登录后任务栏悬空展示。 将 set_anchor() 移出守卫始终调用,仅对 set_size() 保留守卫。 PMS: BUG-295199 Log: 修复新用户登录后任务栏悬空展示问题 Influence: Treeland/Wayland 环境下 layer shell 锚点设置 --- frame/layershell/qwaylandlayershellsurface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/layershell/qwaylandlayershellsurface.cpp b/frame/layershell/qwaylandlayershellsurface.cpp index 586160f4b..143ed215e 100644 --- a/frame/layershell/qwaylandlayershellsurface.cpp +++ b/frame/layershell/qwaylandlayershellsurface.cpp @@ -124,11 +124,11 @@ bool QWaylandLayerShellSurface::anchorsSizeConflict() const void QWaylandLayerShellSurface::trySetAnchorsAndSize() { + set_anchor(m_dlayerShellWindow->anchors()); if (!anchorsSizeConflict()) { - set_anchor(m_dlayerShellWindow->anchors()); set_size(m_requestSize.width(), m_requestSize.height()); - scheduleCommit(); } + scheduleCommit(); } void QWaylandLayerShellSurface::applyLayer()