Skip to content

fix(input): make batch result logic consistent with comment - #852

Merged
Yundi339 merged 1 commit into
masterfrom
codex/backport-lizardbyte-5456
Jul 27, 2026
Merged

fix(input): make batch result logic consistent with comment#852
Yundi339 merged 1 commit into
masterfrom
codex/backport-lizardbyte-5456

Conversation

@Yundi339

Copy link
Copy Markdown
Member

说明

同步上游修复 LizardByte/Sunshine#5456

__builtin_add_overflow 在发生溢出时返回 true。原有判断取反后,会在没有溢出时终止批处理,与注释及函数语义相反。

本 PR 修正以下批处理路径:

  • 相对鼠标移动的 X/Y 增量
  • 垂直滚轮增量
  • 水平滚轮增量

补丁通过 cherry-pick -x 引入,保留上游作者和原始提交来源。

验证

  • 已确认可无冲突应用到当前 master
  • git diff --check 通过
  • 未执行编译、构建或测试命令

(cherry picked from commit eea0bf980a2775ca3e6ccc9c9ff0fac07ca67148)
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Bug Fixes
    • 修复相对鼠标移动及垂直、水平滚轮事件的输入合并逻辑。
    • 改善数值溢出场景下的安全处理,确保事件能够正确中止或继续合并。

Walkthrough

修正相对鼠标移动、垂直滚轮和水平滚轮批处理中的溢出判断,使发生 16-bit 加法溢出时终止消息合并。

Changes

输入批处理溢出判断

Layer / File(s) Summary
输入消息溢出检查修正
src/input.cpp
相对鼠标移动及垂直、水平滚轮消息改为直接判断 __builtin_add_overflow;任一加法溢出时返回 terminate_batch

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: qiin2333

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了批处理逻辑修正,且与本次修复内容一致。
Description check ✅ Passed 描述与变更内容一致,说明了修复范围、来源和验证情况。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 codex/backport-lizardbyte-5456

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.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
src/input.cpp (1)

1423-1426: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

建议补充三类输入的溢出回归测试。

覆盖相对鼠标 X/Y、垂直滚轮和水平滚轮在无溢出时继续合并、在 16-bit 上下界溢出时返回 terminate_batch 的场景。

Also applies to: 1465-1465, 1486-1486

🤖 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/input.cpp` around lines 1423 - 1426, 为处理批次合并逻辑补充溢出回归测试,覆盖相对鼠标
X/Y、垂直滚轮和水平滚轮三类输入。每类都验证未溢出时继续合并,并验证 16-bit 上界及下界溢出时返回 terminate_batch;重点覆盖对应的
deltaX、deltaY 以及滚轮累加逻辑。
🤖 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.

Nitpick comments:
In `@src/input.cpp`:
- Around line 1423-1426: 为处理批次合并逻辑补充溢出回归测试,覆盖相对鼠标
X/Y、垂直滚轮和水平滚轮三类输入。每类都验证未溢出时继续合并,并验证 16-bit 上界及下界溢出时返回 terminate_batch;重点覆盖对应的
deltaX、deltaY 以及滚轮累加逻辑。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eb9e87a4-8a11-41ab-8475-af58024c3b4c

📥 Commits

Reviewing files that changed from the base of the PR and between c172c62 and 8d4bd54.

📒 Files selected for processing (1)
  • src/input.cpp
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Windows
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{cpp,c,h}

⚙️ CodeRabbit configuration file

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

Files:

  • src/input.cpp
🔇 Additional comments (3)
src/input.cpp (3)

1423-1426: LGTM!


1465-1465: LGTM!


1486-1486: LGTM!

@Yundi339
Yundi339 merged commit b6174e3 into master Jul 27, 2026
3 checks passed
@Yundi339
Yundi339 deleted the codex/backport-lizardbyte-5456 branch August 10, 2026 04:38
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