-
Notifications
You must be signed in to change notification settings - Fork 55
fix: disable dock animations during resize operations #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
Reviewer's GuideAdds a resize-state flag to DockPanel, exposes it to QML, and uses it to temporarily disable dock layout animations while the dock is being programmatically resized over D-Bus, preventing animation glitches during resize operations. Sequence diagram for dock resize over D-Bus with animations disabledsequenceDiagram
actor User
participant SettingsApp
participant DockDBusProxy
participant DockPanel
participant QML_DockView
User ->> SettingsApp: Change dock size in settings
SettingsApp ->> DockDBusProxy: resizeDock(offset, dragging=false)
DockDBusProxy ->> DockPanel: setIsResizing(true)
DockPanel ->> QML_DockView: isResizingChanged(true)
QML_DockView ->> QML_DockView: disable layout animations
DockDBusProxy ->> DockPanel: setDockSize(offset)
DockPanel ->> QML_DockView: layout update
DockDBusProxy ->> DockPanel: setIsResizing(false)
DockPanel ->> QML_DockView: isResizingChanged(false)
QML_DockView ->> QML_DockView: reenable layout animations
Class diagram for updated DockPanel resize state handlingclassDiagram
class DockPanel {
+DockPanel(QObject *parent)
+bool showInPrimary
+QString screenName
+bool locked
+qreal devicePixelRatio
+bool contextDragging
+void setContextDragging(bool newContextDragging)
+bool isResizing() const
+void setIsResizing(bool resizing)
void lockedChanged(bool locked)
void contextDraggingChanged()
void isResizingChanged(bool isResizing)
-ColorTheme m_theme
-bool m_compositorReady
-bool m_launcherShown
-bool m_contextDragging
-bool m_isResizing
}
class DockDBusProxy {
+QString getPluginKey(QString pluginName)
+void resizeDock(int offset, bool dragging)
}
DockDBusProxy --> DockPanel : parent()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码的目的是为 Dock 面板添加一个调整大小(resizing)的状态标识,并在调整大小时禁用某些布局动画,以避免动画干扰或性能问题。总体来说,代码逻辑清晰,能够实现预期功能。 以下是从语法逻辑、代码质量、代码性能和代码安全四个方面的详细审查与改进建议: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议代码示例针对代码质量中的格式问题和异常安全性,提供以下修改建议: 1. 修正
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The
isResizingChangedmethod is declared underprivate Q_SLOTSbut used as theNOTIFYsignal for theisResizingQ_PROPERTY; this should be declared in thesignalssection so it is treated as a proper Qt signal rather than just a slot. - In
DockDBusProxy::resizeDock,setIsResizing(true)is set immediately beforesetDockSize(offset)and reset right after; ifsetDockSizetriggers asynchronous or deferred layout/animation work, consider moving the flag handling closer to the real resize lifecycle so that animations stay disabled for the full duration of the operation. - The QML changes gate animations on
!Applet.isResizing, but the new C++ property isDockPanel::isResizing; double-check thatApplet.isResizingis correctly bound to this new property (or switch the QML condition to use the dock’s property directly) to avoid the flag never actually affecting animations.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `isResizingChanged` method is declared under `private Q_SLOTS` but used as the `NOTIFY` signal for the `isResizing` Q_PROPERTY; this should be declared in the `signals` section so it is treated as a proper Qt signal rather than just a slot.
- In `DockDBusProxy::resizeDock`, `setIsResizing(true)` is set immediately before `setDockSize(offset)` and reset right after; if `setDockSize` triggers asynchronous or deferred layout/animation work, consider moving the flag handling closer to the real resize lifecycle so that animations stay disabled for the full duration of the operation.
- The QML changes gate animations on `!Applet.isResizing`, but the new C++ property is `DockPanel::isResizing`; double-check that `Applet.isResizing` is correctly bound to this new property (or switch the QML condition to use the dock’s property directly) to avoid the flag never actually affecting animations.
## Individual Comments
### Comment 1
<location> `panels/dock/dockpanel.h:133` </location>
<code_context>
void lockedChanged(bool locked);
void contextDraggingChanged();
+ void isResizingChanged(bool isResizing);
private:
</code_context>
<issue_to_address>
**issue (bug_risk):** The NOTIFY signal for `isResizing` is declared as a slot, which may break Q_PROPERTY notifications.
Since `isResizingChanged` is declared in a `Q_SLOTS` section, Qt will not register it as a signal, so the `NOTIFY isResizingChanged` on the `Q_PROPERTY` will not function correctly (e.g., QML bindings won’t update). Please move `isResizingChanged` to the `signals` section, and if you still need a slot for internal connections, keep a separate slot that emits this signal.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
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:
fix: 修复停靠栏调整大小时动画干扰问题
此修复防止了通过 D-Bus 调用调整停靠栏大小时动画冲突的问题。之前,动画会
干扰平滑的调整大小操作,导致视觉故障或更新延迟。通过在调整大小操作期间禁
用动画(类似于拖动期间的禁用方式),我们确保当停靠栏大小以编程方式更改时
能够获得平滑且即时的视觉反馈。
Log: 修复了调整停靠栏大小时动画干扰的问题
Influence:
PMS: BUG-339381
Summary by Sourcery
Disable dock layout animations while the dock is being resized programmatically via D-Bus to avoid visual interference and ensure smooth size changes.
Bug Fixes:
Enhancements: