fix(dock): smart hide fails to show dock after window dragged away#1668
Open
fly602 wants to merge 1 commit into
Open
fix(dock): smart hide fails to show dock after window dragged away#1668fly602 wants to merge 1 commit into
fly602 wants to merge 1 commit into
Conversation
deepin pr auto review★ 总体评分:90分 - ■ 【总体评价】 > 代码通过引入hiding标志位和停止定时器有效修复了Dock动画的竞态条件,逻辑严谨且符合预期 > 逻辑正确性高且无安全漏洞,但在代码质量和性能细节上仍有轻微优化空间,故扣10分 - ■ 【详细分析】 > > - 1.语法逻辑(完全正确)✓ > > 在`hideShowAnimation`的`onStarted`和`onStopped`中,新增了`hiding`状态管理逻辑,正确区分了隐藏和显示动画的执行方向。在`onBeforePositionChanged`中增加`hideTimer.stop()`有效防止了位置动画与隐藏动画的竞态。`onHideStateChanged`中通过`hideShowAnimation.hiding`判断是否需要反转正在进行的隐藏动画,逻辑严密。 > > 潜在问题:无 > > 建议:无 - > - 2.代码质量(良好)✓ > > 代码注释清晰,如"Prevent the delayed hide animation from racing the position animation."准确说明了修改意图。简化了`onStopped`中复杂的条件判断,提升了可读性。变量命名`hiding`语义明确。 > > 潜在问题:`onHideStateChanged`中`dock.visible = true`的设置在`else if`块内,如果未来逻辑变更可能遗漏。 > > 建议:保持当前结构即可,但在后续维护时注意`dock.visible`状态的一致性。 - > - 3.代码性能(无性能问题)✓ > > 通过`hideTimer.stop()`和`hideShowAnimation.stop()`提前终止不必要的动画和定时器,避免了无效的动画计算和UI重绘,提升了响应性能。`hideTimer.restart()`相比直接设置`running = true`更安全且语义明确。 > > 潜在问题:无 > > 建议:无 - > - 4.代码安全(存在0个安全漏洞)✓ > > 漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 > > 本次代码修改为UI动画状态管理逻辑优化,不涉及外部输入处理、文件操作、网络通信或敏感权限操作,无安全风险。 > > - 建议:无 - ■ 【改进建议代码示例】// 当前代码已足够完善,以下为保持逻辑一致性的微调建议
Connections {
function onHideStateChanged() {
if (Panel.hideState === Dock.Hide) {
hideTimer.restart()
} else if (Panel.hideState === Dock.Show) {
hideTimer.stop()
// Reverse an in-flight hide animation, but do not restart an
// animation that is already moving towards the shown state.
if (!hideShowAnimation.running || hideShowAnimation.hiding || !dock.visible) {
hideShowAnimation.restart()
}
// 确保 visible 状态在 Show 分支中始终被正确设置
dock.visible = true
}
}
} |
wjyrich
approved these changes
Jul 16, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, wjyrich 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 |
Contributor
Author
|
/force merge |
SmartHide 模式下,show 动画结束后 onStopped 无条件重启 hideTimer,
导致 dock 显示后 500ms 又被隐藏。同时 onHideStateChanged 的 Show
分支未停掉 QML hideTimer,且 hideShowAnimation.restart() 可能被
已运行的动画阻塞。
1. onStopped 中增加 Panel.hideState !== Dock.Show 判断,Show 状态
下不再重启 hideTimer
2. onHideStateChanged Show 分支中先 hideTimer.stop() 再 restart()
show 动画,并强制设置 dock.visible = true
Log: 修复 SmartHide 模式下拖动窗口脱离任务栏后任务栏不自动显示的问题
PMS: BUG-370149
Influence:
1. SmartHide 模式下拖动窗口与任务栏重叠后移开,验证任务栏自动显示
2. SmartHide 模式下快速反复拖动窗口进出任务栏区域,验证无闪烁或卡住
3. KeepShowing 和 KeepHidden 模式下验证任务栏行为无回归
4. 任务栏显示动画过程中再次触发隐藏,验证动画状态正确切换
5. 右键菜单弹出时拖动窗口,验证菜单和任务栏状态无冲突
Contributor
Author
|
/force merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SmartHide 模式下,show 动画结束后 onStopped 无条件重启 hideTimer,
导致 dock 显示后 500ms 又被隐藏。同时 onHideStateChanged 的 Show
分支未停掉 QML hideTimer,且 hideShowAnimation.restart() 可能被
已运行的动画阻塞。
Log: 修复 SmartHide 模式下拖动窗口脱离任务栏后任务栏不自动显示的问题
PMS: BUG-370149
Influence: