fix(input): make batch result logic consistent with comment - #852
Conversation
(cherry picked from commit eea0bf980a2775ca3e6ccc9c9ff0fac07ca67148)
Summary by CodeRabbit
Walkthrough修正相对鼠标移动、垂直滚轮和水平滚轮批处理中的溢出判断,使发生 16-bit 加法溢出时终止消息合并。 Changes输入批处理溢出判断
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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
📒 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!
说明
同步上游修复 LizardByte/Sunshine#5456。
__builtin_add_overflow在发生溢出时返回true。原有判断取反后,会在没有溢出时终止批处理,与注释及函数语义相反。本 PR 修正以下批处理路径:
补丁通过
cherry-pick -x引入,保留上游作者和原始提交来源。验证
mastergit diff --check通过