Skip to content

fix: add fallback cursor name for thumbnail - #283

Open
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/70730ad08cd4
Open

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/70730ad08cd4

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Root Cause Analysis

The second group in presentCursors (themethumb.cpp) only contained "left_ptr_watch" with no fallback name. Cursor themes like Adwaita do not provide a left_ptr_watch file in their cursors/ directory, causing that group to fail loading any cursor image. This reduces the thumbnail from 7 to 6 cursor states, and shifts the remaining icons forward, making the second-to-last icon appear as fleur (four-way arrow) instead of grab (fist). Key evidence: Adwaita's cursors/ has no left_ptr_watch but provides watch → wait; bloom has left_ptr_watch → progress and displays correctly.

Fix

Add "watch" as a fallback cursor name to the second group: {"left_ptr_watch", "watch"}. Themes that already have left_ptr_watch (e.g. bloom) are unaffected since the first name is matched first; themes lacking it (e.g. Adwaita) now fall back to watch.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • The presentCursors variable was introduced in the initial commit (2022-08-09) and its structure has not changed since. Line 27 was last touched by a general theme update commit (BUG-296933/296949), not a targeted bug fix — this change does not revert any historical fix.
  • The only reference to presentCursors is its own definition at themethumb.cpp:33; no external callers are affected. The change is purely additive (one extra string in a QStringList).

Business Impact Scope

Affected module: cursor theme thumbnail preview in Control Center personalization settings. Users selecting cursor themes lacking left_ptr_watch (e.g. Adwaita) will now see all 7 cursor states correctly. Themes with left_ptr_watch (e.g. bloom) remain unchanged.

Verification Suggestion

Test Adwaita cursor theme thumbnail: confirm 7 states display correctly with grab as the second-to-last icon. Test bloom theme: confirm no regression (still 7 states, behavior unchanged).


根因分析

presentCursorsthemethumb.cpp)第 2 组仅包含 "left_ptr_watch",无备选名称。Adwaita 等光标主题的 cursors/ 目录中不存在 left_ptr_watch 文件,导致该组无法加载任何光标图像,缩略图从 7 个状态减少为 6 个,且因位置前移,倒数第二个图标由 grab(拳头)变为 fleur(四角箭头)。关键证据:Adwaita 无 left_ptr_watch 但有 watch → wait;bloom 有 left_ptr_watch → progress,显示正常。

修复方案

在第 2 组添加备选光标名称 "watch"{"left_ptr_watch", "watch"}。已有 left_ptr_watch 的主题(如 bloom)不受影响(第一名称优先匹配);缺少该名称的主题(如 Adwaita)将回退使用 watch

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • presentCursors 变量在初始提交(2022-08-09)引入,结构此后未变。行 27 上次修改为通用主题更新提交(BUG-296933/296949),非针对性 bug 修复——本次修改不会撤销任何历史修复。
  • presentCursors 唯一引用为其自身定义处 themethumb.cpp:33,无外部调用者受影响。改动为纯数据补全(QStringList 中增加一个字符串)。

业务影响范围

受影响模块:控制中心个性化设置中的光标主题缩略图预览。用户选择缺少 left_ptr_watch 的光标主题(如 Adwaita)时,将正确显示 7 个光标状态。已有 left_ptr_watch 的主题(如 bloom)行为不变。

验证建议

测试 Adwaita 光标主题缩略图:确认 7 个状态完整显示,倒数第二个为 grab(拳头)。测试 bloom 主题:确认无回归(仍为 7 个状态,行为不变)。

Summary by Sourcery

Bug Fixes:

  • Add a fallback cursor name so themes without left_ptr_watch can display the complete cursor thumbnail.

1. Root cause: presentCursors second group only had "left_ptr_watch"
   with no fallback, themes like Adwaita lack this file causing
   thumbnail to show 6 states instead of 7 with wrong icon
2. Fix: add "watch" as fallback name, Adwaita provides watch->wait
   symlink so the busy cursor state loads correctly
3. Impact: themes with left_ptr_watch (e.g. bloom) unaffected as
   first name matches first, only themes lacking it get the fallback

Log: Fix cursor thumbnail showing wrong icon for some themes

Influence:
1. Test Adwaita cursor theme thumbnail shows 7 states correctly
2. Test bloom cursor theme thumbnail has no regression
3. Verify second-to-last cursor icon is grab not fleur

fix: 修复部分主题光标缩略图图标错误

1. 根因:presentCursors 第2组仅有"left_ptr_watch"无备选名,Adwaita等
   主题缺少该文件导致缩略图少显示一个状态且图标错位
2. 方案:添加"watch"作为备选光标名,Adwaita提供watch->wait符号链接
   可正确加载忙碌状态光标
3. 影响:已有left_ptr_watch的主题(如bloom)不受影响,仅缺少该名称的
   主题启用备选

Log: 修复部分光标主题缩略图图标显示错误

Influence:
1. 测试Adwaita光标主题缩略图正确显示7个状态
2. 测试bloom光标主题缩略图无回归
3. 验证倒数第二个光标图标为grab而非fleur

PMS: BUG-375317
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy

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

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The cursor thumbnail mapping now falls back from left_ptr_watch to watch, restoring the expected seven cursor states for themes such as Adwaita while leaving existing themes such as bloom unchanged.

Flow diagram for cursor thumbnail fallback selection

flowchart TD
    A["Cursor theme thumbnail requests left_ptr_watch"] --> B{"left_ptr_watch available?"}
    B -->|Yes| C["Use left_ptr_watch"]
    B -->|No| D["Use watch"]
    C --> E["Display seven cursor states"]
    D --> E
Loading

File-Level Changes

Change Details Files
Add a fallback cursor name so the thumbnail’s second cursor state loads across more themes.
  • Try watch when left_ptr_watch is unavailable.
  • Preserve the existing first-name preference for themes that provide left_ptr_watch.
src/service/modules/api/themethumb.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!

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码变更简洁精准,修复了光标缩略图在某些主题下图标显示错误的问题。变更仅添加一个标准 X11 光标名称作为备选,符合现有代码模式,无安全漏洞,无性能影响。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

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.

2 participants