Smooth wheel scrolling: route scroll over sliders to the list or the volume
CI / check (pull_request) Successful in 9s
CI / native (pull_request) Successful in 1m15s

GtkRange's built-in scroll controller moved a slider by its page increment
(10%) per wheel detent, ignored the tilt wheel and returned GDK_EVENT_STOP
for every scroll event, including a touchpad's vertical swipe it did nothing
with. So scrolling a list stopped dead whenever a slider passed under the
pointer and changed that stream's volume instead.

Sliders now replace that controller with one that asks MoonBit
(@model.SliderWheel) synchronously where each event goes:
- while the list is moving (it moved or was sent a scroll < 600 ms ago,
  kinetic deceleration included) events keep scrolling the list;
- otherwise a mouse wheel changes the volume by 2% per detent, fractional
  for high-resolution wheels, tilt wheel included;
- a touchpad gesture is decided at its first movement: mainly vertical
  scrolls the list (kinetic), mainly horizontal moves the knob with the
  fingers (physical direction).

Measured under Xvfb with XTest and 8 playback streams: 12 wheel notches
over a row title used to scroll 3 times and drop a stream from 100% to 20%;
now the list scrolls to the end and no volume changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SpriteandClaude Opus 5.5 committed 2026-11-23 06:44:52 +00:00
1 parent 0760d7ba6c
commit cff5f49dc3
9 files changed
+511 -15

No files matched your search

+11 -2
View File
@@ -35,6 +35,12 @@ on top of libpipewire-0.3. It never runs `wpctl`, `pactl`, `pw-cli`,
- Volumes in percent exactly like pavucontrol/wpctl: the cubic mapping of
PipeWire's linear `channelVolumes`, up to 150%, with the dB value next to
it. One slider moves all channels, keeping the channel balance.
- **Scrolling that does what you mean.** The mouse wheel scrolls the list
even when a slider passes under the pointer; with the pointer resting on a
slider it changes that volume by 2% per detent (high-resolution wheels in
proportion, a tilt wheel too). On a touchpad a vertical swipe always
scrolls the list, with kinetic momentum, and a horizontal swipe over a
slider moves its knob with your fingers.
- **Follows the desktop's accent colour and dark/light style**, live (see
[Appearance](#appearance)).
- Live updates: devices and streams appearing, disappearing or changing
@@ -84,7 +90,8 @@ flowchart LR
- **One main loop.** WirePlumber and GTK4 both run on the default GLib main
context, so events arrive on the GUI thread with no locking or polling.
- **Pure core.** Everything else is plain MoonBit in `model/`: the cubic and
linear conversions, dB formatting, linked-slider scaling, the reducer that
linear conversions, dB formatting, linked-slider scaling, wheel routing
over sliders, the reducer that
applies node, link and default events, the per-tab rows, and the row diff
the GUI applies. `moon test` covers it on any target.
- **GTK binding.** It is hand-written and minimal. Each widget gets a tag
@@ -92,7 +99,9 @@ flowchart LR
single callback. While MoonBit updates widgets from the model, signals are
suppressed so model updates never echo back into PipeWire. For a short
time after the user moves a slider, remote updates to that slider are
ignored so it doesn't jump while being dragged.
ignored so it doesn't jump while being dragged. Sliders replace GtkRange's
scroll handling (10% per detent, swallowing every scroll) with one that
asks MoonBit synchronously whether the slider or the list gets the event.
## Appearance