From e8c01f2c73c840b164d36e7410b84c3c28395ebb Mon Sep 17 00:00:00 2001 From: zhangkun Date: Mon, 26 Jan 2026 17:59:14 +0800 Subject: [PATCH] fix: disable dock animations during resize operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Added m_isResizing property to DockPanel class to track dock resizing state 2. Modified resizeDock method in DockDBusProxy to set resizing flag before and after size changes 3. Updated QML animations to be disabled during both dragging AND resizing operations 4. Added Q_PROPERTY for isResizing with proper getter/setter and signal emission The fix prevents animation conflicts when the dock is being resized through D-Bus calls. Previously, animations would interfere with smooth resizing operations, causing visual glitches or delayed updates. By disabling animations during resize operations (similar to how they're disabled during dragging), we ensure smooth and immediate visual feedback when the dock size changes programmatically. Log: Fixed dock animation interference during resize operations Influence: 1. Test dock resizing through configuration settings or D-Bus calls 2. Verify animations work normally when not resizing or dragging 3. Check that animations are properly disabled during resize operations 4. Test edge cases where resizing and dragging might overlap 5. Verify dock positioning and layout updates correctly during resize fix: 修复停靠栏调整大小时动画干扰问题 1. 在 DockPanel 类中添加 m_isResizing 属性以跟踪停靠栏调整大小状态 2. 修改 DockDBusProxy 中的 resizeDock 方法,在大小更改前后设置调整大小 标志 3. 更新 QML 动画,使其在拖动和调整大小操作期间均被禁用 4. 为 isResizing 添加 Q_PROPERTY,包含适当的 getter/setter 和信号发射 此修复防止了通过 D-Bus 调用调整停靠栏大小时动画冲突的问题。之前,动画会 干扰平滑的调整大小操作,导致视觉故障或更新延迟。通过在调整大小操作期间禁 用动画(类似于拖动期间的禁用方式),我们确保当停靠栏大小以编程方式更改时 能够获得平滑且即时的视觉反馈。 Log: 修复了调整停靠栏大小时动画干扰的问题 Influence: 1. 通过配置设置或 D-Bus 调用测试停靠栏调整大小功能 2. 验证在未调整大小或拖动时动画正常工作 3. 检查动画在调整大小操作期间是否被正确禁用 4. 测试调整大小和拖动可能重叠的边缘情况 5. 验证停靠栏在调整大小期间的位置和布局是否正确更新 PMS: BUG-339381 --- panels/dock/dockdbusproxy.cpp | 2 ++ panels/dock/dockpanel.cpp | 15 +++++++++++++++ panels/dock/dockpanel.h | 6 ++++++ panels/dock/package/main.qml | 4 ++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/panels/dock/dockdbusproxy.cpp b/panels/dock/dockdbusproxy.cpp index 86a8ba191..b5ff337c6 100644 --- a/panels/dock/dockdbusproxy.cpp +++ b/panels/dock/dockdbusproxy.cpp @@ -279,7 +279,9 @@ QString DockDBusProxy::getPluginKey(const QString &pluginName) void DockDBusProxy::resizeDock(int offset, bool dragging) { Q_UNUSED(dragging) + parent()->setIsResizing(true); parent()->setDockSize(offset); + parent()->setIsResizing(false); } bool DockDBusProxy::showInPrimary() const diff --git a/panels/dock/dockpanel.cpp b/panels/dock/dockpanel.cpp index 7185f972b..6b41822de 100644 --- a/panels/dock/dockpanel.cpp +++ b/panels/dock/dockpanel.cpp @@ -39,6 +39,7 @@ DockPanel::DockPanel(QObject *parent) , m_compositorReady(false) , m_launcherShown(false) , m_contextDragging(false) + , m_isResizing(false) { connect(this, &DockPanel::compositorReadyChanged, this, [this] { if (!m_compositorReady) return; @@ -458,6 +459,20 @@ void DockPanel::setContextDragging(bool newContextDragging) m_helper->checkNeedHideOrNot(); emit contextDraggingChanged(); } + +bool DockPanel::isResizing() const +{ + return m_isResizing; + +} + +void DockPanel::setIsResizing(bool resizing) +{ + if (m_isResizing == resizing) + return; + m_isResizing = resizing; + emit isResizingChanged(m_isResizing); +} } #include "dockpanel.moc" diff --git a/panels/dock/dockpanel.h b/panels/dock/dockpanel.h index f574e586b..0b3318ca9 100644 --- a/panels/dock/dockpanel.h +++ b/panels/dock/dockpanel.h @@ -33,6 +33,7 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext Q_PROPERTY(bool showInPrimary READ showInPrimary WRITE setShowInPrimary NOTIFY showInPrimaryChanged FINAL) Q_PROPERTY(QString screenName READ screenName NOTIFY screenNameChanged FINAL) Q_PROPERTY(bool locked READ locked WRITE setLocked NOTIFY lockedChanged FINAL) + Q_PROPERTY(bool isResizing READ isResizing WRITE setIsResizing NOTIFY isResizingChanged FINAL) Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged FINAL) @@ -98,6 +99,9 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext bool contextDragging() const; void setContextDragging(bool newContextDragging); + bool isResizing() const; + void setIsResizing(bool resizing); + protected: bool eventFilter(QObject *watched, QEvent *event) override; @@ -126,6 +130,7 @@ private Q_SLOTS: void lockedChanged(bool locked); void contextDraggingChanged(); + void isResizingChanged(bool isResizing); private: ColorTheme m_theme; @@ -136,6 +141,7 @@ private Q_SLOTS: bool m_compositorReady; bool m_launcherShown; bool m_contextDragging; + bool m_isResizing; }; } diff --git a/panels/dock/package/main.qml b/panels/dock/package/main.qml index 21daae943..32932da40 100644 --- a/panels/dock/package/main.qml +++ b/panels/dock/package/main.qml @@ -484,7 +484,7 @@ Window { (dock.height - dockCenterPart.implicitHeight) / 2 - (dockLeftPart.implicitHeight + 20) + Math.min((dock.height - dockCenterPart.implicitHeight) / 2 - (dockRightPart.implicitHeight + 20), 0) : 0 Behavior on Layout.leftMargin { - enabled: !dock.isDragging + enabled: !dock.isDragging && !Applet.isResizing NumberAnimation { duration: 200 easing.type: Easing.OutCubic @@ -492,7 +492,7 @@ Window { } Behavior on Layout.topMargin { - enabled: !dock.isDragging + enabled: !dock.isDragging && !Applet.isResizing NumberAnimation { duration: 200 easing.type: Easing.OutCubic