feat(input): wire native mouse-wheel scroll on Wayland + Win32, normalize all backends to ±1/detent #34
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-32"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #32
Window::onMouseScrollwas only wired on the DOM/wasm backend; both native window backends silently dropped wheel input, soMouseScrollBindactions were dead on native (found while wiring 3DForts#164).What changed
All three backends now deliver one normalized unit, documented on
Window::onMouseScroll: signed whole detents packed in the uint32 payload, +1 = wheel down (DOM deltaY sign). Sub-detent motion (smooth-scroll touchpads, free-spin wheels) accumulates backend-side until a whole detent is reached, so it adds up instead of truncating to zero per event.Device::PointerListenerHandleAxisimplemented (was an empty stub): vertical axis only,wl_fixed_to_double(value) / 15(libinput's axis-units-per-detent, followed by wlroots/Mutter/KWin), remainder carried inDevice::scrollDetentRemainderand reset on pointer leave.WM_MOUSEWHEELcase:-GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA(negated because Win32 positive = wheel away from user) with the same remainder scheme.dom-env.jsnow normalizesWheelEvent.deltaYperdeltaMode(100 px / 3 lines / 1 page per detent) instead of forwarding raw browser-specific deltas. ⚠️ Behavioral change on wasm: a Chromium detent used to arrive as ±100, a Firefox detent as ±3; both are now ±1, identical to native. If 3DForts tuned scroll sensitivity against raw deltaY, that factor moves into app-side scale — in exchange the binding behaves the same on every platform.Device::focusedWindowunconditionally; sway delivers a secondleaveafter focus is already cleared during input-device hot-plug, which segfaulted. Now guarded.Verification
tests/MouseScroll(new, runs incrafter-build test): drives the Wayland axis handler directly — detent down/up, 5×3-unit smooth-scroll accumulation, direction reversal mid-accumulation, 3-detent flick, horizontal-axis isolation, null-focus safety, remainder reset on leave. 13 checks, all green.zwlr_virtual_pointer_v1client (15 →[Zoom] delta +1, −15 →−1, 45 → 3 detents, 7.5+7.5 → one detent on completion). Confirms compositor →wl_pointer.axis→onMouseScroll→MouseScrollBind→ Axis1D action, with sway's real 15-units-per-detent values.{100,px}→+1,{-100,px}→−1,{3,line}→+1,{300,px}→+3,{50,px}×2→+1.winuser.hand its semantics unit-checked standalone (one detent forward →uint32(-1)).crafter-build test: 2 passed.