-
Notifications
You must be signed in to change notification settings - Fork 55
fix: update window icon geometry when panel position changes #1405
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
fix: update window icon geometry when panel position changes #1405
Conversation
Monitor Panel.rootObject position changes in AppItem and trigger window icon geometry update when position changes. This ensures minimize animations always target the correct taskbar icon position, even after rearranging external displays in extended mode. PMS: BUG-319249 修复:面板位置变化时更新窗口图标几何信息 在 AppItem 中监听 Panel.rootObject 位置变化,并在位置改变时触发窗口图标 几何信息更新。这确保了最小化动画始终指向正确的任务栏图标位置,即使在 扩展模式下重新排列外接显示器之后也是如此。 PMS: BUG-319249
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds reactive handling of panel position changes in AppItem so that window icon geometry is refreshed whenever the dock panel moves, ensuring minimize animations target the correct taskbar icon location after display rearrangements. Sequence diagram for updating window icon geometry on panel movesequenceDiagram
actor User
participant DisplayManager
participant PanelRootObject as Panel_rootObject
participant AppItem
participant UpdateTimer as updateWindowIconGeometryTimer
participant GeometryUpdater as WindowIconGeometryUpdater
User->>DisplayManager: Rearrange_external_displays
DisplayManager->>PanelRootObject: Update_position_x_y
PanelRootObject-->>AppItem: xChanged
AppItem->>UpdateTimer: start()
PanelRootObject-->>AppItem: yChanged
AppItem->>UpdateTimer: start()
UpdateTimer->>GeometryUpdater: updateWindowIconGeometry()
User->>Window: Minimize_window
Window->>GeometryUpdater: Request_target_icon_geometry
GeometryUpdater-->>Window: Current_taskbar_icon_position
Window->>Window: Play_minimize_animation_to_icon
Class diagram for AppItem reactive panel position handlingclassDiagram
class PanelRootObject {
Number x
Number y
}
class UpdateWindowIconGeometryTimer {
+start()
}
class AppItem {
+implicitWidth
+updateWindowIconGeometryTimer : UpdateWindowIconGeometryTimer
+onPanelXChanged()
+onPanelYChanged()
}
class Connections {
+target : PanelRootObject
+onXChanged()
+onYChanged()
}
AppItem o-- UpdateWindowIconGeometryTimer : uses
AppItem o-- Connections : contains
Connections --> PanelRootObject : target
AppItem --> PanelRootObject : observes_position_changes
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码主要是为了在 Dock 面板(Panel)位置发生变化时,触发定时器更新应用图标的几何位置信息。以下是对这段代码的审查意见,包括语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议代码示例 // Monitor Panel position changes to update icon geometry
Connections {
// 确保 target 存在,避免运行时警告或逻辑失效
target: Panel.rootObject ? Panel.rootObject : null
// 忽略 x/y 的微小抖动,或者合并逻辑
function onXChanged() { updateWindowIconGeometryTimer.restart() }
function onYChanged() { updateWindowIconGeometryTimer.restart() }
}改动点说明:
|
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 left some high level feedback:
- Consider guarding against
Panel.rootObjectbeing null or changing at runtime (e.g., by using a boundtargetwithignoreUnknownSignals: trueor checking availability) to avoid potential runtime warnings from theConnectionsobject. - Instead of duplicating logic in
onXChangedandonYChanged, you could factor this into a single handler (e.g., using aonPositionChanged-style signal if available, or a helper function) to keep the update trigger logic in one place.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider guarding against `Panel.rootObject` being null or changing at runtime (e.g., by using a bound `target` with `ignoreUnknownSignals: true` or checking availability) to avoid potential runtime warnings from the `Connections` object.
- Instead of duplicating logic in `onXChanged` and `onYChanged`, you could factor this into a single handler (e.g., using a `onPositionChanged`-style signal if available, or a helper function) to keep the update trigger logic in one place.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, Ivy233 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 |
Monitor Panel.rootObject position changes in AppItem and trigger window icon geometry update when position changes. This ensures minimize animations always target the correct taskbar icon position, even after rearranging external displays in extended mode.
PMS: BUG-319249
修复:面板位置变化时更新窗口图标几何信息
在 AppItem 中监听 Panel.rootObject 位置变化,并在位置改变时触发窗口图标
几何信息更新。这确保了最小化动画始终指向正确的任务栏图标位置,即使在
扩展模式下重新排列外接显示器之后也是如此。
PMS: BUG-319249
Summary by Sourcery
Bug Fixes: