Skip to content

feat(input): add cursor capture options#681

Merged
Yundi339 merged 1 commit into
masterfrom
feat_hide_cursor
May 26, 2026
Merged

feat(input): add cursor capture options#681
Yundi339 merged 1 commit into
masterfrom
feat_hide_cursor

Conversation

@Yundi339
Copy link
Copy Markdown
Member

@Yundi339 Yundi339 commented May 26, 2026

此修改仅对已有的 显示/隐藏光标 快捷键 ctrl + shift + alt + N进行可配置。
目前修复VDD光标不可见的问题,在此#660

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Review Change Stack

Summary by CodeRabbit

发布说明

  • 新功能

    • 新增鼠标光标捕获选项,可在流媒体和录制中显示或隐藏鼠标指针,支持快捷键 Ctrl+Alt+Shift+N 实时切换。
    • 在输入配置界面添加对应的切换开关。
  • 本地化

    • 更新了 20+ 种语言的翻译,支持新增功能的多语言界面显示。

总体说明

该 PR 实现了鼠标光标采集功能的完整配置链路:从后端 C++ 配置结构体定义,到运行时参数应用,再到 Windows 平台视频采集逻辑的集成,最后在前端 Web UI 提供用户控制,并为全部语言包添加本地化支持。

变更内容

鼠标光标采集功能

层级 / 文件 说明
配置字段定义和初始化
src/config.h, src/config.cpp
config::video_t 新增 capture_cursor 布尔字段,默认值为 true,表示默认在视频流中合成主机鼠标光标。
配置解析与应用
src/config.cpp
apply_config() 中新增对 capture_cursor 配置项的解析,并将其应用到 video.capture_cursordisplay_cursor 变量,使运行时光标显示行为与配置同步。
视频采集中的光标可见性检查
src/platform/windows/display_vram.cpp
display_amd_vram_t::snapshot() 中,将光标绘制条件从仅检查 config::input.amf_draw_mouse_cursor 扩展为同时要求 cursor_visible && config::input.amf_draw_mouse_cursor,从而在光标不可见时跳过光标处理。
前端配置界面与默认值
src_assets/common/assets/web/composables/useConfig.js, src_assets/common/assets/web/configs/tabs/Inputs.vue
在 Web 前端默认配置中为 input 选项组添加 capture_cursor: true,并在输入配置界面新增对应的复选框控件及说明文本。
多语言本地化支持
src_assets/common/assets/web/public/assets/locale/*.json (16 个语言包)
在全部语言包中新增 capture_cursorcapture_cursor_desc 本地化文案键,并调整 output_name_vdd_optionoutput_name_windows 的显示顺序。同时对应用层批量操作文案进行了关键重新组织。

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive 作者未提供PR描述,无法评估描述与变更集的相关性。 建议作者添加PR描述,说明该功能的目的、影响范围及相关的快捷键说明等内容。
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR标题清晰准确地反映了主要变更内容——添加鼠标光标捕获选项功能。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat_hide_cursor

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src_assets/common/assets/web/public/assets/locale/en_GB.json`:
- Line 446: The localization key output_name_windows has an unnatural English
value ("Display device specify"); update its value to a clear, readable
label—replace the string for output_name_windows with a natural noun phrase such
as "Display device selection" (or a concise label like "Select display device")
to improve UI clarity.

In `@src_assets/common/assets/web/public/assets/locale/en_US.json`:
- Line 446: The string for the localization key "output_name_windows" has
awkward English ("Display device specify"); update its value to a more natural
phrase by replacing the current value with "Display device selection" for the
"output_name_windows" key so the English copy reads correctly.

In `@src_assets/common/assets/web/public/assets/locale/en.json`:
- Line 472: Replace the awkward string for the localization key
output_name_windows so it reads as a clear noun label; update the value from
"Display Device Specify" to a natural, unambiguous label such as "Display Device
ID" by editing the JSON entry for output_name_windows.

In `@src_assets/common/assets/web/public/assets/locale/sv.json`:
- Line 434: Change the Swedish translation for the key output_name_windows
because "Utdatanamn" (output name) is semantically incorrect; update the value
in src_assets/common/assets/web/public/assets/locale/sv.json for the key
"output_name_windows" to a phrase that conveys "display device ID" (e.g., "Visa
enhets‑ID" or "Enhets‑ID för visning") so it matches the field's actual meaning.

In `@src_assets/common/assets/web/public/assets/locale/tr.json`:
- Line 434: The Turkish translation for the key output_name_windows is
semantically incorrect ("Çıktı Adı" = "Output Name"); update the value for the
JSON key "output_name_windows" to a Turkish phrase that conveys "display device
ID", e.g., replace "Çıktı Adı" with "Görüntü Aygıtı Kimliği" (or "Görüntü Aygıtı
ID'si") so it clearly represents the Windows display device identifier.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5fc1048f-e09e-419b-aae5-d2df3b2fb258

📥 Commits

Reviewing files that changed from the base of the PR and between 1bee5cb and 1e7bd71.

📒 Files selected for processing (25)
  • src/config.cpp
  • src/config.h
  • src/platform/windows/display_vram.cpp
  • src_assets/common/assets/web/composables/useConfig.js
  • src_assets/common/assets/web/configs/tabs/Inputs.vue
  • src_assets/common/assets/web/public/assets/locale/bg.json
  • src_assets/common/assets/web/public/assets/locale/cs.json
  • src_assets/common/assets/web/public/assets/locale/de.json
  • src_assets/common/assets/web/public/assets/locale/en.json
  • src_assets/common/assets/web/public/assets/locale/en_GB.json
  • src_assets/common/assets/web/public/assets/locale/en_US.json
  • src_assets/common/assets/web/public/assets/locale/es.json
  • src_assets/common/assets/web/public/assets/locale/fr.json
  • src_assets/common/assets/web/public/assets/locale/it.json
  • src_assets/common/assets/web/public/assets/locale/ja.json
  • src_assets/common/assets/web/public/assets/locale/ko.json
  • src_assets/common/assets/web/public/assets/locale/pl.json
  • src_assets/common/assets/web/public/assets/locale/pt.json
  • src_assets/common/assets/web/public/assets/locale/pt_BR.json
  • src_assets/common/assets/web/public/assets/locale/ru.json
  • src_assets/common/assets/web/public/assets/locale/sv.json
  • src_assets/common/assets/web/public/assets/locale/tr.json
  • src_assets/common/assets/web/public/assets/locale/uk.json
  • src_assets/common/assets/web/public/assets/locale/zh.json
  • src_assets/common/assets/web/public/assets/locale/zh_TW.json
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{cpp,c,h}

⚙️ CodeRabbit configuration file

src/**/*.{cpp,c,h}: Sunshine 核心 C++ 源码,自托管游戏串流服务器。审查要点:内存安全、 线程安全、RAII 资源管理、安全漏洞。注意预处理宏控制的平台相关代码。

Files:

  • src/config.h
  • src/config.cpp
  • src/platform/windows/display_vram.cpp
src_assets/**/*.{vue,js,html}

⚙️ CodeRabbit configuration file

src_assets/**/*.{vue,js,html}: 基于 Vue.js 的 Web 配置面板。审查 XSS/CSRF 安全性、 组件设计、状态管理和可访问性。

Files:

  • src_assets/common/assets/web/composables/useConfig.js
  • src_assets/common/assets/web/configs/tabs/Inputs.vue
src/platform/**

⚙️ CodeRabbit configuration file

src/platform/**: 平台抽象层代码(Windows/Linux/macOS)。确保各平台实现一致, 注意 Windows API 调用的错误处理和资源释放。

Files:

  • src/platform/windows/display_vram.cpp
🔇 Additional comments (23)
src/config.h (1)

117-117: LGTM!

src/config.cpp (1)

453-453: LGTM!

Also applies to: 1306-1310

src_assets/common/assets/web/composables/useConfig.js (1)

46-46: LGTM!

src_assets/common/assets/web/configs/tabs/Inputs.vue (1)

439-449: LGTM!

src/platform/windows/display_vram.cpp (1)

2827-2832: LGTM!

src_assets/common/assets/web/public/assets/locale/bg.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/cs.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/de.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/en.json (1)

47-54: LGTM!

Also applies to: 181-189, 192-192, 195-200, 247-248, 258-259, 272-283, 319-320, 562-578

src_assets/common/assets/web/public/assets/locale/en_GB.json (1)

47-54: LGTM!

Also applies to: 228-259

src_assets/common/assets/web/public/assets/locale/en_US.json (1)

47-54: LGTM!

Also applies to: 228-259

src_assets/common/assets/web/public/assets/locale/es.json (1)

47-54: LGTM!

Also applies to: 234-235, 433-434

src_assets/common/assets/web/public/assets/locale/fr.json (1)

47-54: LGTM!

Also applies to: 234-235, 433-434

src_assets/common/assets/web/public/assets/locale/it.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/ja.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/ko.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/pl.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/pt.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/pt_BR.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/ru.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/uk.json (1)

47-54: LGTM!

Also applies to: 234-235, 434-434

src_assets/common/assets/web/public/assets/locale/zh.json (1)

47-54: LGTM!

Also applies to: 181-189, 192-192, 195-200, 258-259, 272-283, 319-320, 472-472, 562-579

src_assets/common/assets/web/public/assets/locale/zh_TW.json (1)

47-54: LGTM!

Also applies to: 234-235, 248-259, 446-446

"output_name_unix": "Display number",
"output_name_windows": "Display device specify",
"output_name_vdd_option": "Just gimme VDD~ ✨",
"output_name_windows": "Display device specify",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

output_name_windows 文案语法不正确,建议改为可读标签。

当前 "Display device specify" 不符合英语表达,建议改成名词短语(例如 Display device selection),避免界面歧义。

✏️ 建议修改
-    "output_name_windows": "Display device specify",
+    "output_name_windows": "Display device selection",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"output_name_windows": "Display device specify",
"output_name_windows": "Display device selection",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/common/assets/web/public/assets/locale/en_GB.json` at line 446,
The localization key output_name_windows has an unnatural English value
("Display device specify"); update its value to a clear, readable label—replace
the string for output_name_windows with a natural noun phrase such as "Display
device selection" (or a concise label like "Select display device") to improve
UI clarity.

"output_name_unix": "Display number",
"output_name_windows": "Display device specify",
"output_name_vdd_option": "Just gimme VDD~ ✨",
"output_name_windows": "Display device specify",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

output_name_windows 英文文案建议修正语法。

"Display device specify" 表达不自然,建议改为 "Display device selection"

✏️ 建议修改
-    "output_name_windows": "Display device specify",
+    "output_name_windows": "Display device selection",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"output_name_windows": "Display device specify",
"output_name_windows": "Display device selection",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/common/assets/web/public/assets/locale/en_US.json` at line 446,
The string for the localization key "output_name_windows" has awkward English
("Display device specify"); update its value to a more natural phrase by
replacing the current value with "Display device selection" for the
"output_name_windows" key so the English copy reads correctly.

"output_name_unix": "Display number",
"output_name_windows": "Display Device Specify",
"output_name_vdd_option": "Just gimme VDD~ ✨",
"output_name_windows": "Display Device Specify",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

修正配置项文案语义错误

Line 472 的 output_name_windows 为 “Display Device Specify”,语义和语法都不自然,容易让用户误解字段用途。建议改为明确的名词标签(如 Display Device ID)。

💡 建议修改
-    "output_name_windows": "Display Device Specify",
+    "output_name_windows": "Display Device ID",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"output_name_windows": "Display Device Specify",
"output_name_windows": "Display Device ID",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/common/assets/web/public/assets/locale/en.json` at line 472,
Replace the awkward string for the localization key output_name_windows so it
reads as a clear noun label; update the value from "Display Device Specify" to a
natural, unambiguous label such as "Display Device ID" by editing the JSON entry
for output_name_windows.

"output_name_unix": "Visa nummer",
"output_name_windows": "Utdatanamn",
"output_name_vdd_option": "Jag vill ha VDD ~ ✨",
"output_name_windows": "Utdatanamn",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

output_name_windows 瑞典语语义偏差,建议改为“显示设备 ID”相关表述。

Line 434 目前是 “Utdatanamn”(输出名称),与该字段实际含义(显示设备标识)不一致,可能误导用户配置目标设备。

建议修复
-    "output_name_windows": "Utdatanamn",
+    "output_name_windows": "Skärmenhets-ID",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"output_name_windows": "Utdatanamn",
"output_name_windows": "Skärmenhets-ID",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/common/assets/web/public/assets/locale/sv.json` at line 434,
Change the Swedish translation for the key output_name_windows because
"Utdatanamn" (output name) is semantically incorrect; update the value in
src_assets/common/assets/web/public/assets/locale/sv.json for the key
"output_name_windows" to a phrase that conveys "display device ID" (e.g., "Visa
enhets‑ID" or "Enhets‑ID för visning") so it matches the field's actual meaning.

"output_name_unix": "Ekran numarası",
"output_name_windows": "Çıktı Adı",
"output_name_vdd_option": "VDD istiyorum, bitti ~ ✨",
"output_name_windows": "Çıktı Adı",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

output_name_windows 土耳其语翻译语义不准确。

Line 434 的 “Çıktı Adı” 更像“输出名称”,但该项实际是 Windows 显示设备标识字段,建议改成“显示设备 ID”语义以避免误解。

建议修复
-    "output_name_windows": "Çıktı Adı",
+    "output_name_windows": "Ekran Aygıtı Kimliği",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"output_name_windows": "Çıktı Adı",
"output_name_windows": "Ekran Aygıtı Kimliği",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/common/assets/web/public/assets/locale/tr.json` at line 434, The
Turkish translation for the key output_name_windows is semantically incorrect
("Çıktı Adı" = "Output Name"); update the value for the JSON key
"output_name_windows" to a Turkish phrase that conveys "display device ID",
e.g., replace "Çıktı Adı" with "Görüntü Aygıtı Kimliği" (or "Görüntü Aygıtı
ID'si") so it clearly represents the Windows display device identifier.

@Yundi339 Yundi339 merged commit 6281e0c into master May 26, 2026
4 checks passed
@Yundi339 Yundi339 deleted the feat_hide_cursor branch May 26, 2026 00:56
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.

1 participant