Skip to content

Conversation

@jouyouyun
Copy link
Contributor

@jouyouyun jouyouyun commented Jun 8, 2025

Firefox HiDPI has already adapted to GDK and Xft.dpi, so there is no need to set devPixelsPerPx anymore.

Summary by Sourcery

Remove obsolete Firefox DPI configuration from the xsettings service now that HiDPI is handled by GDK and Xft.dpi.

Enhancements:

  • Remove updateFirefoxDPI goroutine invocation from service startup.
  • Delete Firefox DPI helper functions (updateFirefoxDPI, getFirefoxConfigs, setFirefoxDPI) and related imports and variables.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jouyouyun

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

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 8, 2025

Reviewer's Guide

This PR removes the custom Firefox DPI (devPixelsPerPx) adjustment, as Firefox HiDPI now uses GDK/Xft.dpi automatically.

Sequence Diagram: Depiction of Removed Firefox DPI Update Logic

sequenceDiagram
    participant S as xsettings.Start()
    participant XSM as XSManager
    participant FFC as Firefox Config Files

    Note right of S: This entire interaction was removed.
    S ->> XSM: go m.updateFirefoxDPI()
    activate XSM
    XSM ->> XSM: scale = m.cfgHelper.GetDouble(gsKeyScaleFactor)
    XSM ->> FFC: getFirefoxConfigs(ffDir)
    activate FFC
    FFC -->> XSM: configs
    deactivate FFC
    loop For each Firefox profile config
        XSM ->> FFC: setFirefoxDPI(scale, config, config)
        activate FFC
        FFC -->> XSM: status
        deactivate FFC
    end
    deactivate XSM
Loading

Class Diagram: Method Removal from XSManager

classDiagram
    class XSManager {
        -updateFirefoxDPI()
    }
Loading

File-Level Changes

Change Details Files
Remove Firefox DPI adjustment logic
  • Deleted ffDir constant
  • Removed updateFirefoxDPI method
  • Removed getFirefoxConfigs and setFirefoxDPI helpers
  • Cleaned up now-unused imports (os, path, strings, utils)
xsettings1/xsettings_dpi.go
Stop invoking Firefox DPI updater
  • Removed go m.updateFirefoxDPI() call from Start
xsettings1/xsettings.go

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 @jouyouyun - I've reviewed your changes and they look 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-bot
Copy link
Contributor

deepin-bot bot commented Jun 12, 2025

TAG Bot

TAG: 6.1.39
EXISTED: yes
DISTRIBUTION: unstable

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 19, 2025

TAG Bot

New tag: 6.1.37
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #811

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 20, 2025

TAG Bot

New tag: 6.1.38
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #815

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 21, 2025

TAG Bot

New tag: 6.1.39
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #817

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 23, 2025

TAG Bot

New tag: 6.1.40
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #819

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 27, 2025

TAG Bot

New tag: 6.1.41
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #822

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 3, 2025

TAG Bot

New tag: 6.1.42
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #828

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 10, 2025

TAG Bot

New tag: 6.1.43
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #834

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 15, 2025

TAG Bot

New tag: 6.1.44
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #837

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 22, 2025

TAG Bot

New tag: 6.1.45
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #843

Firefox HiDPI has already adapted to GDK and Xft.dpi, so there is no
need to set devPixelsPerPx anymore.
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 移除未使用的代码

    • xsettings.go文件中,移除了go m.updateFirefoxDPI()这一行,这可能是为了简化代码或暂时禁用该功能。如果这个功能不再需要,建议完全移除相关的代码,包括xsettings_dpi.go文件中的所有与updateFirefoxDPI相关的函数。
  2. 错误处理

    • updateFirefoxDPI函数中,当读取Firefox配置文件时,如果发生错误,应该记录错误并继续处理其他配置文件,而不是立即返回。这样可以提高代码的健壮性。
  3. 代码重复

    • setFirefoxDPI函数中,tmp变量的赋值逻辑重复了两次,建议将这部分逻辑提取出来,减少代码重复。
  4. 日志记录

    • setFirefoxDPI函数中,当设置DPI时,如果配置文件已经包含目标行,应该记录一条日志,说明配置文件已经是最新的,不需要修改。这可以帮助调试和监控。
  5. 硬编码的路径

    • ffDir变量是硬编码的,建议使用配置文件或环境变量来设置Firefox配置文件的路径,以提高代码的可配置性和可移植性。
  6. 字符串格式化

    • setFirefoxDPI函数中,target变量的格式化使用了%.2f,这可能会导致精度问题。如果DPI值不需要精确到小数点后两位,建议使用%.1f%.0f
  7. 文件权限

    • setFirefoxDPI函数中,写入配置文件时使用了0644权限,这可能会限制其他用户的修改权限。如果需要,可以考虑使用更宽松的权限,如0664
  8. 错误信息

    • getFirefoxConfigs函数中,当读取目录时发生错误,应该返回一个更具体的错误信息,而不是简单的err

综上所述,建议对代码进行重构,移除未使用的功能,优化错误处理和日志记录,减少代码重复,并提高代码的可配置性和安全性。

@jouyouyun
Copy link
Contributor Author

/approve

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 31, 2025

TAG Bot

New tag: 6.1.46
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #852

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 1, 2025

TAG Bot

New tag: 6.1.47
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #853

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 8, 2025

TAG Bot

New tag: 6.1.48
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #856

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 12, 2025

TAG Bot

New tag: 6.1.49
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #857

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 15, 2025

TAG Bot

New tag: 6.1.50
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #862

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 21, 2025

TAG Bot

New tag: 6.1.51
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #871

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 28, 2025

TAG Bot

New tag: 6.1.52
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #881

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 4, 2025

TAG Bot

New tag: 6.1.53
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #888

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 11, 2025

TAG Bot

New tag: 6.1.54
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #893

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 12, 2025

TAG Bot

New tag: 6.1.55
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #895

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 18, 2025

TAG Bot

New tag: 6.1.56
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #904

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 25, 2025

TAG Bot

New tag: 6.1.57
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #920

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 10, 2025

TAG Bot

New tag: 6.1.58
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #924

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 16, 2025

TAG Bot

New tag: 6.1.59
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #934

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 30, 2025

TAG Bot

New tag: 6.1.62
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #951

@qaqland
Copy link

qaqland commented Nov 6, 2025

fixed in #952

@qaqland qaqland closed this Nov 6, 2025
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