Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Aug 21, 2025

  1. Replaced problematic windowEffect approach with direct shadowColor control
  2. Set shadow color to transparent during hideShowAnimation to avoid visual artifacts
  3. Maintain proper shadow opacity (60% black) when animation is not running
  4. Fixes the bug where window shadows would persist incorrectly after animations

fix: 修复任务栏窗口阴影动画问题

  1. 用直接的阴影颜色控制替换有问题的 windowEffect 方法
  2. 在 hideShowAnimation 期间将阴影颜色设置为透明以避免视觉伪影
  3. 在动画未运行时保持正确的阴影不透明度(60%黑色)
  4. 修复动画后窗口阴影错误持续存在的问题

Pms: BUG-317241

Summary by Sourcery

Fix dock panel window shadow animation by replacing the faulty windowEffect approach with direct shadowColor control, hiding the shadow during animations, and restoring proper shadow opacity afterwards.

Bug Fixes:

  • Replace the problematic windowEffect with direct shadowColor control to avoid animation issues
  • Set shadowColor to transparent during hideShowAnimation to eliminate visual artifacts
  • Restore 60% black shadow opacity when not animating
  • Prevent lingering window shadows after animations complete

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR replaces the unreliable windowEffect-based shadow handling with direct shadowColor and borderWidth bindings tied to the hideShowAnimation state, ensuring transparent shadows during transitions and restoring proper 60% black shadows and borders afterward.

Sequence diagram for shadow and border animation during hide/show

sequenceDiagram
    participant DWindow
    participant hideShowAnimation
    hideShowAnimation->>DWindow: Start animation (running = true)
    DWindow->>DWindow: Set shadowColor to transparent
    DWindow->>DWindow: Set borderWidth to 0
    hideShowAnimation->>DWindow: End animation (running = false)
    DWindow->>DWindow: Set shadowColor to 60% black
    DWindow->>DWindow: Set borderWidth to 1
Loading

File-Level Changes

Change Details Files
Replace windowEffect approach with direct shadowColor control
  • Remove the D.DWindow.windowEffect binding
  • Introduce D.DWindow.shadowColor property for explicit shadow control
panels/dock/package/main.qml
Tie shadow transparency and border width to animation state
  • Set shadowColor to transparent when hideShowAnimation.running is true
  • Restore shadowColor to 60% black when hideShowAnimation.running is false
  • Set borderWidth to 0 during animation
  • Set borderWidth to 1 after animation
panels/dock/package/main.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

18202781743
18202781743 previously approved these changes Aug 21, 2025
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wjyrich, yixinshark

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

1. Replaced problematic windowEffect approach with direct shadowColor
control
2. Set shadow color to transparent during hideShowAnimation to avoid
visual artifacts
3. Maintain proper shadow opacity (60% black) when animation is not
running
4. Fixes the bug where window shadows would persist incorrectly after
animations

fix: 修复任务栏窗口阴影动画问题

1. 用直接的阴影颜色控制替换有问题的 windowEffect 方法
2. 在 hideShowAnimation 期间将阴影颜色设置为透明以避免视觉伪影
3. 在动画未运行时保持正确的阴影不透明度(60%黑色)
4. 修复动画后窗口阴影错误持续存在的问题

Pms: BUG-317241
@deepin-ci-robot
Copy link

deepin pr auto review

这段代码是关于dock面板窗口效果的实现,我来分析一下代码并提供改进建议:

1. 语法逻辑分析

  • 代码使用了条件运算符来控制窗口的阴影和边框属性,逻辑基本清晰
  • 通过hideShowAnimation.running状态来切换窗口效果

2. 代码质量问题

  • 注释中提到了一个未解决的BUG,表明代码可能存在临时解决方案
  • 使用了硬编码的透明度值(255 * 0.6),建议定义为常量以提高可维护性
  • 阴影颜色的切换逻辑不够直观,可以进一步优化

3. 性能考虑

  • 频繁切换阴影和边框可能会影响渲染性能
  • 每次动画运行时都会重新计算颜色值,可以考虑预定义这些值

4. 安全性考虑

  • 没有明显的安全隐患,但建议对动画状态进行适当的错误处理

改进建议:

  1. 定义常量提高可维护性:
// 在文件顶部定义常量
readonly property real SHADOW_OPACITY: 0.6
readonly color SHADOW_COLOR_DEFAULT: Qt.rgba(0, 0, 0, 255 * SHADOW_OPACITY)
readonly color SHADOW_COLOR_TRANSPARENT: Qt.rgba(0, 0, 0, 0)
  1. 优化阴影和边框控制逻辑:
// 使用更直观的属性控制
property bool isAnimationRunning: hideShowAnimation.running

D.DWindow.shadowColor: isAnimationRunning ? SHADOW_COLOR_TRANSPARENT : SHADOW_COLOR_DEFAULT
D.DWindow.borderWidth: isAnimationRunning ? 0 : 1
  1. 添加错误处理:
// 在动画状态变化时添加检查
onIsAnimationRunningChanged: {
    if (isAnimationRunning && D.DWindow.windowEffect === 0) {
        console.warn("Animation is running but window effect is not properly set")
    }
}
  1. 考虑使用状态机来管理窗口状态,使状态转换更加清晰和可控。

  2. 建议将TODO注释更新为更详细的问题描述和解决方案计划:

// TODO: WindowEffect存在BUG,导致动画结束后无法正确恢复阴影和边框
// 当前临时解决方案:手动控制shadowColor和borderWidth
// 计划:在WindowEffect修复后,改回使用windowEffect属性

这些改进将使代码更加健壮、可维护,并可能提高性能。同时,更好的错误处理和状态管理将有助于调试和未来的维护工作。

@yixinshark
Copy link
Contributor

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Aug 21, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 9630ee1 into linuxdeepin:master Aug 21, 2025
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants