Skip to content

fix: unify screen scaling management with ScreenScale plugin#60

Open
fly602 wants to merge 1 commit into
linuxdeepin:masterfrom
fly602:master
Open

fix: unify screen scaling management with ScreenScale plugin#60
fly602 wants to merge 1 commit into
linuxdeepin:masterfrom
fly602:master

Conversation

@fly602
Copy link
Copy Markdown
Contributor

@fly602 fly602 commented Apr 14, 2026

Refactored the XSettings scaling logic to use the new ScreenScale plugin as the primary source of truth. The XSettingsManager now delegates scale factor updates to the "org.deepin.dde.ScreenScale1" D-Bus service. This change removes redundant scaling calculations and ensures that scaling configurations are synchronized correctly between XSettings and the dedicated scaling service. Added a fallback synchronization logic in onScaleFactorChanged for cases where the ScreenScale service is unavailable.

Influence:

  1. Verify screen scaling updates via XSettings D-Bus and DConfig keys.
  2. Ensure ScreenScale1 service correctly handles SetScaleFactor calls.
  3. Confirm Plymouth and GTK cursor size are updated on scale changes.
  4. Test backward compatibility for apps relying on existing D-Bus properties.

fix: 统一屏幕缩放管理到 ScreenScale 插件

重构了 XSettings 缩放逻辑,将 ScreenScale 插件作为缩放配置的事实来源。
XSettingsManager 现在将缩放因子更新操作委托给
"org.deepin.dde.ScreenScale1" D-Bus 服务。此更改删除了冗余的缩放计算逻 辑,并确保 XSettings 与专用缩放服务之间的配置保持同步。同时,在
ScreenScale 服务不可用时,在 onScaleFactorChanged 中提供了回退同步逻辑。

影响范围:

  1. 验证通过 XSettings D-Bus 和 DConfig 键进行的屏幕缩放更新是否生效。
  2. 确认 ScreenScale1 服务能正确处理 SetScaleFactor 调用。
  3. 确保缩放因子更改时,Plymouth 和 GTK 光标大小能正确更新。
  4. 检查与依赖现有 XSettings D-Bus 属性的应用程序的向后兼容性。

pms: BUG-355227
Change-Id: I2363239245451fc5079c39e6b76042d42a87b2a4

Summary by Sourcery

Unify screen scaling management around a new ScreenScale D-Bus plugin and make it the single source of truth for XSettings and related components.

New Features:

  • Introduce a ScreenScale D-Bus plugin providing scale factor, recommended scale, and available scale values backed by DConfig and QScreen data.

Bug Fixes:

  • Ensure scale factor changes are consistently propagated to XSettings, Plymouth, and cursor size even when the ScreenScale service is temporarily unavailable.

Enhancements:

  • Refactor XSettingsManager to read and write scale factors via the ScreenScale1 service instead of local DConfig keys or per-screen scaling logic.
  • Simplify recommended scale factor computation in XSettingsManager by delegating to the ScreenScale service and falling back to defaults when necessary.
  • Remove legacy Firefox DPI adjustment logic and obsolete per-screen scaling parsing from XSettingsManager.
  • Clean up legacy screen-scaling-related environment variables from .dde_env during startup migration.

Build:

  • Add build targets and installation rules for the new ScreenScale plugin, its D-Bus and systemd service files, and DConfig metadata.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602

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

@fly602 fly602 requested a review from deepin-ci-robot April 14, 2026 08:59
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 14, 2026

Reviewer's Guide

Refactors XSettings screen scaling to delegate to a new org.deepin.dde.ScreenScale1 D-Bus plugin as the single source of truth, adds the ScreenScale plugin implementation and service wiring, and updates XSettingsManager to synchronize legacy DConfig/XSettings, Plymouth, and cursor size via the new service with fallback logic when the service is unavailable.

Sequence diagram for runtime screen scale change via ScreenScale1

sequenceDiagram
    actor User
    participant App
    participant XSettingsManager
    participant ScreenScale1
    participant DConfig_ScreenScale as DConfig_ScreenScale1
    participant DConfig_XSettings as DConfig_XSettings
    participant Plymouth

    User->>App: Change scale in UI
    App->>XSettingsManager: setScreenScaleFactors(factors, emitSignal)
    XSettingsManager->>XSettingsManager: setSingleScaleFactor(scale, emitSignal)
    XSettingsManager->>ScreenScale1: SetScaleFactor(scale)
    ScreenScale1->>DConfig_ScreenScale: setValue("scale-factor", scale)
    DConfig_ScreenScale-->>ScreenScale1: write OK
    ScreenScale1-->>XSettingsManager: ScaleFactorChanged(scale)
    Note over ScreenScale1,XSettingsManager: XSettingsManager subscribed to ScaleFactorChanged signal
    XSettingsManager->>XSettingsManager: onScaleFactorChanged(scale)
    XSettingsManager->>DConfig_XSettings: setValue(dcKeyScaleFactor, scale)
    XSettingsManager->>DConfig_XSettings: setValue(dcKeyWindowScale, windowScale)
    XSettingsManager->>DConfig_XSettings: setValue(cKeyIndividualScaling, joinedFactors)
    XSettingsManager->>DConfig_XSettings: setValue(dcKeyGtkCursorThemeSize, cursorSize)
    XSettingsManager->>Plymouth: setScaleFactorForPlymouth(windowScale, false)
    XSettingsManager-->>App: scale change persisted (effective after relogin)

    alt ScreenScale1 unavailable
        XSettingsManager->>XSettingsManager: onScaleFactorChanged(scale) (fallback)
        XSettingsManager->>DConfig_XSettings: update legacy keys
        XSettingsManager->>Plymouth: setScaleFactorForPlymouth(windowScale, false)
    end
Loading

File-Level Changes

Change Details Files
Make ScreenScale1 D-Bus service the single source of truth for global screen scaling and refactor XSettingsManager to consume it with migration/fallback behavior.
  • Instantiate QDBusInterface for org.deepin.dde.ScreenScale1 in XSettingsManager and connect its ScaleFactorChanged signal to a new onScaleFactorChanged(double) slot.
  • On startup, read initial scale via getScaleFactor() from ScreenScale1; if missing, fall back to legacy force-scale-factor.ini or recommended value and optionally push it back to ScreenScale1.
  • Replace DConfig-based getScaleFactor/getScreenScaleFactors with queries to ScreenScale1 and a simple "all" ScaleFactors map.
  • Simplify setScreenScaleFactors to derive a single factor (prefer "all") and delegate to setSingleScaleFactor without persisting individual-scaling to DConfig.
  • Exclude individual-scaling from handleDConfigChangedCb reactions to avoid feedback loops.
  • Change getRecommendedScaleFactor to prefer ScreenScale1.RecommendedScale over DBus, falling back to force-scale-factor.ini or 1.0.
  • Remove legacy DPI-based scaling recommendation and adjustScaleFactor migration logic, as well as Firefox DPI update logic and parseScreenFactors helper.
  • Introduce setSingleScaleFactor that primarily pushes the scale to ScreenScale1 via SetScaleFactor, with error handling and a manual fallback path calling onScaleFactorChanged when the service is unavailable.
  • Implement onScaleFactorChanged to persist scale/window-scale/individual-scaling and cursor size to DConfig, update Plymouth config (without runtime DPI/Qt theme updates), and serve as the central config sync path.
  • Perform one-time initialization sync: call onScaleFactorChanged(initScale), set Qt-specific scale factors, update DPI, and clean up legacy .dde_env scale-related env vars when migration flag is set.
  • Adjust joinScreenScaleFactors to append instead of overwrite when building the factors string and update some logging/formatting and SPDX headers.
src/plugin-qt/xsettings/impl/xsettingsmanager.cpp
src/plugin-qt/xsettings/impl/xsettingsmanager.h
Introduce the ScreenScale plugin (plugin-dde-screenscale) implementing org.deepin.dde.ScreenScale1 D-Bus interface, with DConfig-backed state, screen-based recommendations, and system integration.
  • Add ScreenScale QObject implementing org.deepin.dde.ScreenScale1 D-Bus interface with properties ScaleFactor, RecommendedScale, and AvailableScales, backed by a DConfig org.deepin.dde.ScreenScale1 schema.
  • Implement scale recommendation and quantization helpers using QGuiApplication screens, physical sizes, and a configurable step size, exposed via RecommendedScale and AvailableScales.
  • On ScreenScale construction, initialize DConfig scale-factor to a recommended value when unset, watch scale-step changes to emit AvailableScalesChanged and RecommendedScaleChanged, and react to screen add/remove events to recompute recommendations.
  • Provide GetScaleFactor and SetScaleFactor slots; SetScaleFactor validates against the available scale list, rejects NaN/Infinity and out-of-range values with D-Bus errors, writes to DConfig, and emits ScaleFactorChanged on success.
  • Add plugin entry points DSMRegister/DSMUnRegister to register the ScreenScale object on the given QDBusConnection path derived from the service name, exporting all slots/signals/properties and cleaning up on uninstall.
  • Create CMakeLists.txt for plugin-dde-screenscale module, wiring Qt Core/DBus/Gui and Dtk Core, and installing the module, D-Bus service file, systemd user service, DSM plugin config, and DConfig meta JSON.
  • Wire the new screenscale subdirectory into src/plugin-qt/CMakeLists.txt and add empty placeholder misc files for D-Bus, systemd, plugin, and DConfig metadata definitions.
src/plugin-qt/screenscale/impl/screenscale.cpp
src/plugin-qt/screenscale/impl/screenscale.h
src/plugin-qt/screenscale/plugin.cpp
src/plugin-qt/screenscale/CMakeLists.txt
src/plugin-qt/screenscale/misc/dbus/org.deepin.dde.ScreenScale1.service
src/plugin-qt/screenscale/misc/org.deepin.dde.ScreenScale1.json
src/plugin-qt/screenscale/misc/org.deepin.dde.ScreenScale1.service
src/plugin-qt/screenscale/misc/plugin-dde-screenscale.json
src/plugin-qt/CMakeLists.txt

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

@fly602 fly602 requested a review from deepin-admin-bot April 14, 2026 09:00
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 reviewed your changes and they look great!


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.

@fly602 fly602 force-pushed the master branch 2 times, most recently from cb7ca9b to 81adb0e Compare April 15, 2026 07:17
}

double minScaleFactor = 3.0;
for (auto &&screen : screens) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const auto *screen : screens

connect(m_config,
&DTK_CORE_NAMESPACE::DConfig::valueChanged,
this,
[this](const QString &key) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

一行写即可。

, m_config(DTK_CORE_NAMESPACE::DConfig::create(
"org.deepin.dde.daemon", "org.deepin.dde.ScreenScale1", "", this))
{
if (!m_config) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

|| !m_config->isValid()

return;
}

if (m_config->isValid()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

上面添加了,这里可以去掉。

return range;
}

double ScreenScale::getRecommendedScale() const
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

没看到哪里调用

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

推荐值,可以协助调试或者查看当前的缩放。

found = true;
break;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这里直接可以使用contains判断吧

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

浮点数精度误差,因此需要qFuzzyCompare比较

return;
}

if (qFuzzyCompare(GetScaleFactor(), factor)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个可以提前判断

#include <algorithm>
#include <cmath>

namespace {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

建议这里面的函数都改成类的private, 这里写全局的,没有别人调用。

@@ -0,0 +1,4 @@
[D-BUS Service]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

需要配置一些安全策略吗

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

session 级dbus,不需要配置安全策略

"magic": "dsg.config.meta",
"version": "1.0",
"contents": {
"scale-factor": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

小驼峰模式

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/misc/org.deepin.dde.ScreenScale1.service
DESTINATION lib/systemd/user/
RENAME org.deepin.dde.ScreenScale1.service
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不需要

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/misc/plugin-dde-screenscale.json DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/deepin-service-manager/user)

# Install dconf config meta
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/misc/org.deepin.dde.ScreenScale1.json DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dsg/configs/org.deepin.dde.daemon)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dtk_add_config_meta_files

@@ -0,0 +1,14 @@
[Unit]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不需要这个文件,只需要dbus的service文件

Comment thread src/plugin-qt/screenscale/plugin.cpp Outdated
return 1;
}

screenScale = new ScreenScale();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

std::make_unique<>, 推荐使用只能指针

"/org/deepin/dde/Greeter1",
"org.deepin.dde.Greeter1",
QDBusConnection::systemBus()))
, m_sysDaemonInterface(new QDBusInterface("com.deepin.daemon.Daemon",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个没有了就去掉。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

这个需要,接口名变了而已,dde-daemon中设置plymouth缩放的

@fly602 fly602 force-pushed the master branch 6 times, most recently from 4b639da to 7890d93 Compare April 23, 2026 12:09
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查报告

1. 整体架构与设计

优点

  1. 新增了独立的 screenscale 插件,将屏幕缩放逻辑从 xsettings 中分离,提高了代码的模块化和可维护性
  2. 使用 D-Bus 服务进行通信,实现了组件间的解耦
  3. 采用了 DTK 的 DConfig 配置管理,统一了配置管理方式

改进建议

  1. 服务依赖关系xsettings 依赖 screenscale 服务,但没有明确的依赖声明。建议在 plugin-dde-xsettings.json 中添加依赖关系声明,确保 screenscale 服务先启动。

  2. 版本兼容性:代码中删除了 scalefactorhelper 类,这可能会影响旧版本的兼容性。建议添加迁移逻辑,确保从旧版本升级时的平滑过渡。

2. 语法与逻辑问题

screenscale.cpp

  1. GetScreenScaleInfo 方法

    double step = getScaleStep();
    • 问题:如果 m_config 无效,getScaleStep() 会返回默认值 0.25,但没有日志记录
    • 建议:添加日志记录,明确使用了默认步长
  2. calcRecommendedScale 方法

    double a = 0.00158; // 经验修正系数
    • 问题:魔法数字没有解释来源
    • 建议:添加更详细的注释,说明这个系数是如何确定的
  3. SetScaleFactor 方法

    if (std::isnan(factor) || std::isinf(factor) || factor < 1.0 || factor > 3.0) {
    • 问题:浮点数比较可能不准确
    • 建议:使用 qFuzzyCompare 进行浮点数比较

xsettingsmanager.cpp

  1. getScaleInfoFromService 方法

    QDBusReply<QString> reply = m_screenScaleInterface->call("GetScreenScaleInfo", screensJson);
    if (!reply.isValid()) {
        return {0.0, 0.0};
    }
    • 问题:没有记录错误原因
    • 建议:添加错误日志,便于调试
  2. onScaleFactorChanged 方法

    void XSettingsManager::onScaleFactorChanged(double scale)
    {
        if (scale <= 0.1) {
            return;
        }
    • 问题:使用了硬编码的阈值 0.1
    • 建议:定义常量 MIN_VALID_SCALE_FACTOR = 0.1
  3. setSingleScaleFactor 方法

    emitSignalSetScaleFactor(false, emitSignal);
    • 问题:emitSignalSetScaleFactor 方法在头文件中没有声明
    • 建议:检查方法声明是否遗漏

3. 代码质量问题

  1. 资源管理

    • screenscale.cpp 中的 m_config 指针没有使用智能指针
    • 建议:使用 QScopedPointerstd::unique_ptr 管理资源
  2. 错误处理

    • 多处 D-Bus 调用没有充分的错误处理
    • 建议:添加更详细的错误处理和日志记录
  3. 代码重复

    • screenscale.cppxsettingsmanager.cpp 中都有缩放计算逻辑
    • 建议:考虑将公共逻辑提取到共享工具类中
  4. 命名规范

    • 部分变量命名不够清晰,如 afix
    • 建议:使用更具描述性的名称

4. 性能问题

  1. D-Bus 调用

    • getScaleInfoFromService 方法在初始化时会被调用,可能阻塞主线程
    • 建议:考虑使用异步调用或在工作线程中执行
  2. JSON 解析

    • GetScreenScaleInfo 方法中多次进行 JSON 解析
    • 建议:考虑缓存解析结果,避免重复解析
  3. 配置读取

    • 频繁读取 DConfig 配置可能影响性能
    • 建议:考虑使用配置缓存机制

5. 安全问题

  1. 输入验证

    QString ScreenScale::GetScreenScaleInfo(const QString &screensJson)
    • 问题:没有对输入的 JSON 字符串进行长度和格式验证
    • 建议:添加输入验证,防止恶意输入
  2. 权限控制

    • org.deepin.dde.ScreenScale1.conf 允许所有用户调用方法
    <policy context="default">
      <allow send_destination="org.deepin.dde.ScreenScale1"/>
      <allow receive_sender="org.deepin.dde.ScreenScale1"/>
    </policy>
    • 问题:可能存在安全风险
    • 建议:考虑限制只有特定用户或组可以调用敏感方法
  3. 配置文件权限

    • DConfig 配置文件的权限设置需要确保安全
    • 建议:检查配置文件权限,确保只有授权用户可以修改
  4. D-Bus 服务安全

    • org.deepin.dde.ScreenScale1.servicedeepin-daemon 用户身份运行
    • 建议:确保该用户权限最小化,遵循最小权限原则

6. 其他建议

  1. 测试覆盖

    • 建议添加单元测试,特别是对缩放计算逻辑的测试
    • 建议添加集成测试,验证服务间的交互
  2. 文档完善

    • 建议添加 API 文档,说明各个方法的用途和参数
    • 建议添加架构设计文档,说明组件间的关系
  3. 日志记录

    • 建议统一日志格式,便于日志分析
    • 建议添加关键操作的日志记录
  4. 代码注释

    • 建议添加更多注释,特别是复杂算法的解释
    • 建议更新过时的注释

总结

整体代码结构清晰,模块化设计良好,但在错误处理、输入验证、性能优化和安全方面还有改进空间。建议优先解决安全和输入验证问题,然后逐步改进代码质量和性能。

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented Apr 24, 2026

TAG Bot

New tag: 1.0.22
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #62

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented Apr 24, 2026

TAG Bot

New tag: 1.0.23
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #64

1. Add new ScreenScale plugin (org.deepin.dde.ScreenScale1) as the
single source of truth for screen scale factors
2. Implement GetScreenScaleInfo and SetScaleFactor DBus methods with
automatic recommended scale calculation
3. Refactor XSettings to delegate scale management to ScreenScale
service via DBus
4. Remove deprecated ScaleFactorHelper, updateFirefoxDPI, and related
legacy code
5. Standardize CMake variable naming from BIN_NAME to PLUGIN_NAME across
all plugins
6. Update copyright years from 2025 to 2025-2026
7. Use dtk_add_config_meta_files for DConfig installation

Log: Added centralized screen scale management service with automatic
recommended scale calculation based on monitor physical dimensions

Influence:
1. Test GetScreenScaleInfo with various screen configurations (single
monitor, multi-monitor, HiDPI)
2. Verify SetScaleFactor validates input range (1.0-3.0) and persists
via DConfig
3. Test scale factor synchronization between ScreenScale and XSettings
services
4. Verify ScaleFactorChanged signal propagation across services
5. Test recommended scale calculation accuracy for different monitor
sizes
6. Verify backward compatibility with existing scale configurations
7. Test plugin loading/unloading via deepin-service-manager
8. Verify DBus permission policies for ScreenScale1 service

feat: 添加屏幕缩放插件并重构缩放管理

1. 新增 ScreenScale 插件 (org.deepin.dde.ScreenScale1) 作为屏幕缩放比例
的唯一事实来源
2. 实现 GetScreenScaleInfo 和 SetScaleFactor DBus 方法,支持自动计算推荐
缩放比例
3. 重构 XSettings 插件,通过 DBus 将缩放管理委托给 ScreenScale 服务
4. 移除已废弃的 ScaleFactorHelper、updateFirefoxDPI 及相关遗留代码
5. 统一各插件 CMake 变量命名,将 BIN_NAME 改为 PLUGIN_NAME
6. 更新版权年份从 2025 到 2025-2026
7. 使用 dtk_add_config_meta_files 安装 DConfig 配置

Log: 新增屏幕缩放管理服务,支持根据显示器物理尺寸自动计算推荐缩放比例

Influence:
1. 测试 GetScreenScaleInfo 接口,覆盖单屏、多屏、HiDPI 等场景
2. 验证 SetScaleFactor 对输入范围 (1.0-3.0) 的校验及 DConfig 持久化
3. 测试 ScreenScale 与 XSettings 服务间的缩放比例同步
4. 验证 ScaleFactorChanged 信号在各服务间的传播
5. 测试不同显示器尺寸下推荐缩放比例计算的准确性
6. 验证与现有缩放配置的向后兼容性
7. 测试通过 deepin-service-manager 加载/卸载插件
8. 验证 ScreenScale1 服务的 DBus 权限策略

PMS: BUG-355227
Change-Id: I17fbc039b207e020b74b5183b78463b97ef9eb3e
4. 多屏 (笔记本 + 外接显示器):
[{"widthPx":1920,"heightPx":1080,"widthMm":310,"heightMm":174},{"widthPx":2560,"heightPx":1440,"widthMm":597,"heightMm":336}]
*/
QString ScreenScale::GetScreenScaleInfo(const QString &screensJson)
Copy link
Copy Markdown
Contributor

@yixinshark yixinshark Apr 29, 2026

Choose a reason for hiding this comment

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

widthPx
heightPx
physicalWidthMm
physicalHeightMm
建议参数名称

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 8, 2026

TAG Bot

New tag: 1.0.24
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #66

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 15, 2026

TAG Bot

New tag: 1.0.25
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #68

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