Skip to content

fix: disable smooth rendering for tray icons to prevent blur#1544

Open
wjyrich wants to merge 1 commit intolinuxdeepin:masterfrom
wjyrich:fix-bug-mohu
Open

fix: disable smooth rendering for tray icons to prevent blur#1544
wjyrich wants to merge 1 commit intolinuxdeepin:masterfrom
wjyrich:fix-bug-mohu

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented Apr 3, 2026

  1. Removed smooth: false from AppletItemButton.qml and moved it to Component.onCompleted to ensure it's applied after component initialization
  2. Added smooth: false to PanelTrayItem.qml's IconItem to prevent blurry icons in quick panel
  3. Replaced ShellSurfaceItem with ShellSurfaceItemProxy in ActionLegacyTrayPluginDelegate.qml and updated hover/tap handler parent references
  4. Added fixPosition function to ShellSurfaceItemProxy to handle position adjustments when tray items move
  5. Added smooth property setting to IconItem in PanelTrayItem.qml to ensure consistent rendering

Log: Fixed blurry tray icons in dock and quick panel

Influence:

  1. Verify tray icons appear sharp and not blurry in both dock and quick panel
  2. Test hover and click functionality on legacy tray icons
  3. Check that tray icon positioning remains stable when moving dock items
  4. Ensure all tray icons maintain consistent visual quality
  5. Test with various icon sizes and scaling factors

fix: 禁用托盘图标平滑渲染以防止模糊

  1. 从 AppletItemButton.qml 中移除 smooth: false 并将其移至 Component.onCompleted,确保在组件初始化后应用
  2. 在 PanelTrayItem.qml 的 IconItem 中添加 smooth: false 以防止快速面 板中的图标模糊
  3. 在 ActionLegacyTrayPluginDelegate.qml 中将 ShellSurfaceItem 替换为 ShellSurfaceItemProxy,并更新悬停/点击处理器的父引用
  4. 在 ShellSurfaceItemProxy 中添加 fixPosition 函数以处理托盘项目移动时 的位置调整
  5. 在 PanelTrayItem.qml 的 IconItem 中添加平滑属性设置以确保一致的渲染 效果

Log: 修复了托盘和快速面板中托盘图标模糊的问题

Influence:

  1. 验证托盘图标在托盘和快速面板中显示清晰不模糊
  2. 测试传统托盘图标的悬停和点击功能
  3. 检查移动托盘项目时图标位置是否保持稳定
  4. 确保所有托盘图标保持一致的视觉质量
  5. 测试不同图标大小和缩放比例下的显示效果

Summary by Sourcery

Improve tray icon rendering quality and interaction by adjusting icon smoothing and using a proxy wrapper for legacy tray shell surfaces.

Bug Fixes:

  • Prevent blurry tray icons in the dock by explicitly disabling smoothing after applet button initialization.
  • Prevent blurry tray icons in the quick panel by disabling smoothing on tray icon items.
  • Ensure legacy tray item positions stay correct when tray items move by triggering position fixes on global position changes.

Enhancements:

  • Introduce ShellSurfaceItemProxy as a wrapper around ShellSurfaceItem to expose the underlying item and encapsulate focus/position handling for legacy tray items.
  • Update hover and tap handlers for legacy tray items to attach to the underlying shell surface item rather than the proxy, improving event targeting.

1. Removed `smooth: false` from AppletItemButton.qml and moved it
to Component.onCompleted to ensure it's applied after component
initialization
2. Added `smooth: false` to PanelTrayItem.qml's IconItem to prevent
blurry icons in quick panel
3. Replaced ShellSurfaceItem with ShellSurfaceItemProxy in
ActionLegacyTrayPluginDelegate.qml and updated hover/tap handler parent
references
4. Added fixPosition function to ShellSurfaceItemProxy to handle
position adjustments when tray items move
5. Added smooth property setting to IconItem in PanelTrayItem.qml to
ensure consistent rendering

Log: Fixed blurry tray icons in dock and quick panel

Influence:
1. Verify tray icons appear sharp and not blurry in both dock and quick
panel
2. Test hover and click functionality on legacy tray icons
3. Check that tray icon positioning remains stable when moving dock
items
4. Ensure all tray icons maintain consistent visual quality
5. Test with various icon sizes and scaling factors

fix: 禁用托盘图标平滑渲染以防止模糊

1. 从 AppletItemButton.qml 中移除 `smooth: false` 并将其移至
Component.onCompleted,确保在组件初始化后应用
2. 在 PanelTrayItem.qml 的 IconItem 中添加 `smooth: false` 以防止快速面
板中的图标模糊
3. 在 ActionLegacyTrayPluginDelegate.qml 中将 ShellSurfaceItem 替换为
ShellSurfaceItemProxy,并更新悬停/点击处理器的父引用
4. 在 ShellSurfaceItemProxy 中添加 fixPosition 函数以处理托盘项目移动时
的位置调整
5. 在 PanelTrayItem.qml 的 IconItem 中添加平滑属性设置以确保一致的渲染
效果

Log: 修复了托盘和快速面板中托盘图标模糊的问题

Influence:
1. 验证托盘图标在托盘和快速面板中显示清晰不模糊
2. 测试传统托盘图标的悬停和点击功能
3. 检查移动托盘项目时图标位置是否保持稳定
4. 确保所有托盘图标保持一致的视觉质量
5. 测试不同图标大小和缩放比例下的显示效果
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes direct smooth rendering configuration from the dock tray icon button, centralizes non-smooth icon rendering via Component.onCompleted and quick panel IconItem properties, and refactors legacy tray shell surface handling to go through a ShellSurfaceItemProxy that exposes the underlying ShellSurfaceItem and a position-fixing helper used when tray items move.

Sequence diagram for legacy tray item movement and position fixing

sequenceDiagram
    participant PluginItem
    participant ActionLegacyTrayPluginDelegate as Delegate
    participant ShellSurfaceItemProxy as Proxy
    participant ShellSurfaceItem as ShellItem
    participant FixPositionTimer as Timer

    PluginItem->>Delegate: itemGlobalPosChanged
    Delegate->>Delegate: onItemGlobalPosChanged
    Delegate->>Delegate: updatePluginItemPosTimer.start()
    Delegate->>Proxy: fixPosition()
    Proxy->>Timer: fixPositionTimer.start()
    Timer-->>Proxy: timeout
    Proxy->>ShellItem: adjust position based on tray layout
Loading

Sequence diagram for hover and tap events via ShellSurfaceItemProxy

sequenceDiagram
    actor User
    participant Pointer
    participant HoverHandler as Hover
    participant TapHandler as Tap
    participant ShellSurfaceItemProxy as Proxy
    participant ShellSurfaceItem as ShellItem

    User->>Pointer: move over legacy tray icon
    Pointer->>Hover: update
    Hover->>ShellItem: hover event (parent is ShellItem)
    ShellItem->>Proxy: update hovered state
    Proxy-->>Hover: hovered property

    User->>Pointer: click legacy tray icon
    Pointer->>Tap: press and release
    Tap->>ShellItem: tap event (parent is ShellItem)
    ShellItem->>Proxy: update pressed state and activate shellSurface
    Proxy-->>Tap: pressed property
Loading

Class diagram for updated tray icon components and proxy

classDiagram
    class AppletItemButton {
        IconButton base
        +int icon_width
        +int icon_height
        +Component_onCompleted()
    }

    class ContentItem {
        +bool smooth
    }

    class PanelTrayItem {
        Control base
    }

    class IconItem {
        +string name
        +palette palette
        +theme theme
        +bool smooth
    }

    class ShellSurfaceItemProxy {
        Item base
        +ShellSurface shellSurface
        +bool hovered
        +bool pressed
        +int cursorShape
        +ShellSurfaceItem shellSurfaceItem
        +void takeFocus()
        +void fixPosition()
    }

    class ShellSurfaceItem {
        +int width
        +int height
        +void takeFocus()
    }

    class HoverHandler {
        Item parent
        +bool hovered
    }

    class TapHandler {
        Item parent
        +bool pressed
    }

    AppletItemButton o-- ContentItem : contentItem
    PanelTrayItem o-- IconItem : trayIcon
    ShellSurfaceItemProxy o-- ShellSurfaceItem : impl
    ShellSurfaceItemProxy o-- HoverHandler : hoverHandler
    ShellSurfaceItemProxy o-- TapHandler : tapHandler
    HoverHandler --> ShellSurfaceItem : parent
    TapHandler --> ShellSurfaceItem : parent
Loading

Flow diagram for applying non-smooth icon rendering

flowchart TD
    A[AppletItemButton created] --> B[Component_onCompleted]
    B --> C[Set contentItem.smooth = false]

    D[PanelTrayItem created] --> E[Create IconItem]
    E --> F[Set IconItem.smooth = false]

    C --> G[Dock tray icons render sharp]
    F --> H[Quick panel tray icons render sharp]
Loading

File-Level Changes

Change Details Files
Route legacy tray shell surfaces through ShellSurfaceItemProxy and adjust input handlers/positioning.
  • Replace direct ShellSurfaceItem usage with DDT.ShellSurfaceItemProxy and bind it to the plugin shellSurface.
  • Move HoverHandler and TapHandler parents to the proxy's exposed shellSurfaceItem so events attach to the underlying surface item.
  • Invoke a new fixPosition helper on the proxy when the tray item’s global position changes to keep the shell surface aligned.
  • Expose the inner ShellSurfaceItem via a shellSurfaceItem alias on ShellSurfaceItemProxy and add a fixPosition() function that starts an internal timer.
panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml
panels/dock/tray/ShellSurfaceItemProxy.qml
Ensure tray icons render without smoothing to avoid blur in dock and quick panel.
  • Remove the static smooth: false property from AppletItemButton and instead set contentItem.smooth = false in Component.onCompleted so it applies after initialization.
  • Set smooth: false on the IconItem used in the quick panel tray to keep those icons sharp.
  • Standardize where smooth is configured on icon content so dock and quick panel use consistent non-smooth rendering.
panels/dock/AppletItemButton.qml
panels/dock/tray/quickpanel/PanelTrayItem.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
Copy Markdown

@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 - I've left some high level feedback:

  • In AppletItemButton.qml, consider making the smooth assignment resilient to runtime changes to contentItem (e.g., guard with a null check or react to contentItem changes) so it doesn’t silently break if the underlying control implementation changes.
  • In ShellSurfaceItemProxy.qml, it might be clearer to route hover/tap handling directly through the proxy (e.g., dedicated functions or signals) rather than having external code reach into the shellSurfaceItem alias, which tightens coupling to the internal implementation.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In AppletItemButton.qml, consider making the `smooth` assignment resilient to runtime changes to `contentItem` (e.g., guard with a null check or react to `contentItem` changes) so it doesn’t silently break if the underlying control implementation changes.
- In ShellSurfaceItemProxy.qml, it might be clearer to route hover/tap handling directly through the proxy (e.g., dedicated functions or signals) rather than having external code reach into the `shellSurfaceItem` alias, which tightens coupling to the internal implementation.

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.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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.

3 participants