fix(apple): scroll from trackpads/Magic Mouse — forward NSEvent scrollWheel, drop GC scroll
ci / rust (push) Has been cancelled

Scroll was wired to GCMouse's scroll dpad, which only fires for plain HID wheel
deltas — trackpad and Magic Mouse scrolling are gesture events that never reach
GameController, so scrolling was dead on the default Mac setups. The stream view now
overrides scrollWheel (while captured the cursor is parked mid-view, so it receives
every scroll event) and feeds InputCapture.sendScroll: precise gesture deltas are
pixels (~0.1 notch/px, SDL's factor → ×12 for WHEEL_DELTA(120)), classic wheels are
lines (×120), fractional remainders accumulate, and the GC scroll handler is gone so
wheel mice can't double-deliver. Signs pass through as-is, preserving the local
(natural-)scrolling preference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 23:17:23 +02:00
parent a9d1c16067
commit a730ca8557
3 changed files with 40 additions and 14 deletions
@@ -215,6 +215,23 @@ public final class StreamLayerView: NSView {
super.mouseUp(with: event)
}
/// Scroll is forwarded from here, not from GCMouse: trackpad/Magic Mouse gestures
/// never reach GameController's scroll dpad. While captured the cursor is parked
/// mid-view, so this view receives every scroll event. Precise (gesture) deltas are
/// pixels ~0.1 wheel notch per pixel (SDL's factor) ×12 for WHEEL_DELTA(120);
/// classic wheels report lines, one notch = ±1 ×120. Signs pass through as-is,
/// preserving the user's local (natural-)scrolling preference.
public override func scrollWheel(with event: NSEvent) {
guard captured, let inputCapture else {
super.scrollWheel(with: event)
return
}
let scale: Float = event.hasPreciseScrollingDeltas ? 12 : 120
inputCapture.sendScroll(
dx: Float(event.scrollingDeltaX) * scale,
dy: Float(event.scrollingDeltaY) * scale)
}
// While captured, the view is first responder and consumes key events GC delivers
// them to the host independently, and consuming here stops the responder chain's
// "unhandled keyDown" beep without touching the event stream GC may rely on.