Files
msime-windows/engine/contracts/webview
fanlusky 426bb9d544 feat(server): WebView2 候选窗口支持滚轮翻页,并加上开关
PR #351 只给 D2D 候选窗口加了滚轮翻页,WebView2 后端还没有。

网页端只上报一个以 WHEEL_DELTA 为单位的原始 delta,notch 累加仍然
交给 CandidateWheel::ConsumeWheelDelta,两个宿主最终都汇聚到
WM_PAGE_CANDIDATE,翻页逻辑一份不重复。Chromium 的 wheelDeltaY 本身
就是 ±120/格,正是原生累加器期望的单位,deltaY 作标准回退。

同时把滚轮翻页做成可配置的 general.paging_mouse_wheel,默认关闭:
候选宿主是 NOACTIVATE 且从不获得焦点,滚轮只有在 Windows「当我悬停
在非活动窗口上方时滚动它们」开启时才会送达,无法无条件承诺,所以设为
opt-in,设置页里也写明了这个前提。开关只在 WM_PAGE_CANDIDATE 一处
判断;D2D 那边在 WM_MOUSEWHEEL 顶部提前返回 false,关闭时消息照旧
交给 DefWindowProc,与功能加入前一致。
2026-09-13 01:02:02 +08:00
..

WebView messages

messages.json owns the message envelope, payload shape, and allowed sender windows. Change it here, run python3 generate.py, and re-sync the copy under ui-html/ in the same commit. The generated TypeScript union and embedded C++ schema must pass generate.py --check. runtime.js and validator.h implement the documented schema subset and run the same fixtures.json compatibility cases. The standalone CMake test requires Boost.JSON; the input engine itself does not acquire that dependency.

New messages carry protocolVersion: 1. A missing version is accepted as legacy v1 for existing skins; an explicit unknown version, unknown message, invalid payload, or message sent from the wrong window is rejected before dispatch. This is envelope validation, not a replacement for domain checks such as dictionary key validation, allowed configuration values, or the host's HTTPS URL policy.

ui-html/scripts/sync-contracts.py materializes these bindings into ui-html/webview2/shared and checks byte equality; CI runs it with --check, which now compares against this directory directly rather than against a pinned submodule. Settings imports the typed serializer and checks incoming messages. Classic candidate, toolbar and menu pages load the same runtime from the host's https://msime-contracts/ virtual mapping; packaging must include webview2/shared.

Server-to-page candidate rendering currently uses the existing view functions; this contract covers WebMessage actions and settings responses. Candidate view model ownership is documented separately from transport envelopes.