Skip to content

Conversation

@zccrs
Copy link
Member

@zccrs zccrs commented Apr 8, 2025

pms: BUG-306733

Summary by Sourcery

Fix blurry display of dock plugins on screens with 1.25 scale ratio

Bug Fixes:

  • Resolve image blurring issue for dock plugins on fractional screen scaling by disabling smooth scaling and adjusting scale factor calculation

Enhancements:

  • Improve rendering precision for dock plugin items on non-integer screen scales

Chores:

  • Remove global Qt scale factor for the application to prevent unintended scaling

@zccrs zccrs requested a review from Copilot April 8, 2025 11:30
@sourcery-ai
Copy link

sourcery-ai bot commented Apr 8, 2025

Reviewer's Guide by Sourcery

This pull request addresses a blurring issue in the dock plugin when the screen scale ratio is 1.25. It disables smooth scaling in ShellSurfaceItemProxy.qml and corrects the scale factor calculation in pluginmanagerextension.cpp. Additionally, it unsets the QT_SCALE_FACTOR environment variable to prevent it from affecting plugins.

Updated class diagram for PluginScaleManager

classDiagram
  class PluginScaleManager {
    -QWaylandCompositor* m_compositor
    -uint32_t m_scale
    +void setPluginScale(const uint32_t &scale)
    +void initialize()
  }
  PluginScaleManager : QObject
  note for PluginScaleManager "Corrected scale factor calculation to use 120.0 instead of 120 to avoid rounding errors."
Loading

File-Level Changes

Change Details Files
Fixed a blurring issue in ShellSurfaceItem when the screen scale ratio is 1.25 by disabling smooth scaling.
  • Set smooth: false in ShellSurfaceItemProxy.qml to prevent linear interpolation when scaling.
  • Added a comment explaining the reason for disabling smooth scaling and a TODO for re-enabling it under certain conditions.
panels/dock/tray/ShellSurfaceItemProxy.qml
Corrected the calculation of the scale factor for outputs to ensure accurate scaling.
  • Changed integer division to floating-point division in PluginScaleManager::setPluginScale to avoid truncation.
  • Changed integer division to floating-point division in the output added signal handler to avoid truncation.
panels/dock/pluginmanagerextension.cpp
Unset the QT_SCALE_FACTOR environment variable to prevent it from affecting plugins.
  • Added qunsetenv("QT_SCALE_FACTOR") in main.cpp to prevent scaling issues in plugins.
shell/main.cpp

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • panels/dock/tray/ShellSurfaceItemProxy.qml: Language not supported
Comments suppressed due to low confidence (2)

panels/dock/pluginmanagerextension.cpp:47

  • Using 120.0 ensures floating-point division, which fixes the scale factor calculation. Consider extracting the constant 120.0 into a named variable for better maintainability.
output->setScaleFactor(std::ceil(m_scale / 120.0));

panels/dock/pluginmanagerextension.cpp:67

  • Using 120.0 ensures floating-point division, which fixes the scale factor calculation. Consider extracting the constant 120.0 into a named variable for better maintainability.
output->setScaleFactor(std::ceil(m_scale / 120.0));

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 @zccrs - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The QML change has a TODO, create a ticket to track this work.
  • The QML change has a detailed comment explaining the reasoning behind the change - this is great!
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • pluginmanagerextension.cpp中,将整数除法改为浮点数除法,以确保结果为浮点数。
  • ShellSurfaceItemProxy.qml中,添加了对smooth属性的设置,以避免图像在缩放时模糊。
  • ShellSurfaceItemProxy.qml中,添加了mapToScenemapFromScene函数,用于坐标转换。
  • ShellSurfaceItemProxy.qml中,添加了一个定时器fixPositionTimer,用于修复位置问题。
  • main.cpp中,移除了QT_SCALE_FACTOR环境变量,以避免对插件应用缩放。

是否建议立即修改:

  • 是,这些修改提高了代码的准确性和性能,并且修复了一些潜在的问题。特别是坐标转换和图像平滑处理对于用户体验至关重要。

@zccrs zccrs merged commit c123140 into linuxdeepin:master Apr 10, 2025
7 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.

3 participants