Skip to content

feat(input): add low latency touch toggle#46

Merged
qiin2333 merged 1 commit into
masterfrom
codex/input-latency-touch-toggle
Jun 18, 2026
Merged

feat(input): add low latency touch toggle#46
qiin2333 merged 1 commit into
masterfrom
codex/input-latency-touch-toggle

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 去掉滚轮热路径里的逐帧日志,别再让日志在输入路径里捣乱啦,杂鱼日志退散
  • 新增“低延迟触摸参数”设置,默认关闭,不影响现有手感
  • 开启后缩短鼠标触摸/触控板模式的点击确认、释放等待和长按拖拽确认时间

为啥要改

  • 滚轮输入属于热路径,持续打印会增加不必要的调度和 I/O 压力
  • 触摸点击原本为了稳妥保留了等待窗口,现在给低延迟玩家一个可选的更激进参数组

验证

  • git diff --check
  • npm run test:sunshine-mock
  • JAVA_HOME=/Users/mac/ohos-sdk-cache/jdk17-temurin/Home PATH=/Users/mac/ohos-sdk-cache/jdk17-temurin/Home/bin:$PATH NODE_PATH="$PWD/hvigor/node_modules:$PWD/node_modules" DEVECO_SDK_HOME=/Users/mac/ohos-sdk-cache/6.1-Release-mac/sdk-ci-shape node hvigorw.js assembleHap --mode module -p module=entry@default -p product=default --no-daemon --stacktrace

Summary by CodeRabbit

发布说明

  • 新功能

    • 新增低延迟触摸设置选项,用户可在设置中的"鼠标和触控"分组启用或禁用。
    • 低延迟模式优化触摸输入响应延迟,通过调整鼠标按键和触控板手势的时序参数提升交互流畅性。
  • Bug 修复

    • 移除滚轮处理中的调试日志输出。

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 068903fe-0e67-40f0-b0ba-301de971aa0c

📥 Commits

Reviewing files that changed from the base of the PR and between dfda356 and e5aa0c8.

📒 Files selected for processing (7)
  • entry/src/main/ets/model/StreamConfig.ets
  • entry/src/main/ets/pages/SettingsPageV2.ets
  • entry/src/main/ets/pages/StreamPage.ets
  • entry/src/main/ets/service/SettingsService.ets
  • entry/src/main/ets/service/input/TouchInputHandler.ets
  • entry/src/main/ets/service/input/TrackpadGestureHandler.ets
  • entry/src/main/ets/service/streaming/StreamInputHandler.ets
💤 Files with no reviewable changes (1)
  • entry/src/main/ets/service/streaming/StreamInputHandler.ets

📝 Walkthrough

Walkthrough

新增"低延迟触摸"功能:在 SettingsKeysStreamConfigInputSettings 中添加 lowLatencyTouch 字段;TrackpadGestureHandlerTouchInputHandler 将固定定时阈值拆分为标准/低延迟两套,并分别新增 updateLatencyMode/setLowLatencyTouch 运行时切换方法;StreamPage 在串流启动时注入该配置;SettingsPageV2 暴露对应 UI 开关。同时移除一处滚轮调试日志。

Changes

低延迟触摸模式全链路实现

Layer / File(s) Summary
数据契约与持久化键定义
entry/src/main/ets/service/SettingsService.ets, entry/src/main/ets/model/StreamConfig.ets
SettingsKeysInputSettingsStreamConfig 接口中新增 lowLatencyTouch 字段,getDefaultStreamConfig() 默认值为 false
SettingsService 读取与分发
entry/src/main/ets/service/SettingsService.ets
getStreamConfig()getInputSettings() 均从 PreferencesUtil 读取 LOW_LATENCY_TOUCH 布尔值(默认 false)写入返回对象。
设置页面 UI 开关
entry/src/main/ets/pages/SettingsPageV2.ets
新增 @State lowLatencyTouchloadSettings() 中初始化,"鼠标和触控"分组增加 toggle 控件并在切换时持久化。
TrackpadGestureHandler 延迟模式切换
entry/src/main/ets/service/input/TrackpadGestureHandler.ets
将拖拽阈值、双击按住阈值、点击释放延迟拆分为标准/低延迟常量对,新增实例字段及 updateLatencyMode(enable) 运行时切换方法,所有定时器改用实例字段。
TouchInputHandler 延迟模式切换与 StreamPage 注入
entry/src/main/ets/service/input/TouchInputHandler.ets, entry/src/main/ets/pages/StreamPage.ets
长按/死区/释放延迟常量拆分为标准/低延迟两套,新增 setLowLatencyTouch(enable) 更新实例阈值并透传 trackpad.updateLatencyMode(enable)StreamPage.startStreaming() 在启动时注入该配置。
移除调试日志
entry/src/main/ets/service/streaming/StreamInputHandler.ets
移除竖直滚轮分支中的一条 console.info 调试日志,行为不变。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确总结了主要变更内容:新增低延迟触控切换功能,与changeset中StreamConfig、SettingsPageV2、TouchInputHandler等核心改动直接对应。
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/input-latency-touch-toggle

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.

@qiin2333 qiin2333 merged commit cbc746d into master Jun 18, 2026
2 checks passed
@qiin2333 qiin2333 deleted the codex/input-latency-touch-toggle branch June 18, 2026 09:30
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