Files
moonmix/model/pkg.generated.mbti
T
SpriteandClaude Opus 5.5 cff5f49dc3
CI / check (pull_request) Successful in 9s
CI / native (pull_request) Successful in 1m15s
Smooth wheel scrolling: route scroll over sliders to the list or the volume
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>
2026-11-23 06:44:52 +00:00

256 lines
5.4 KiB
Plaintext

// Generated using `moon info`, DON'T EDIT IT
package "geordi/moonmix/model"
import {
"moonbitlang/core/debug",
}
// Values
pub const APP_LOOKUP_PREFIX : String = "app:"
pub const FILE_ICON_PREFIX : String = "file:"
pub const ICON_MISSING : String = "image-missing"
pub const LIST_LATCH_US : Int64 = 600_000
pub const MAX_PERCENT : Double = 150.0
pub const METER_DECAY : Double = 0.04
pub const MIN_TEXT_CONTRAST : Double = 4.5
pub const MIN_UI_CONTRAST : Double = 3.0
pub const NORM_PERCENT : Double = 100.0
pub const WHEEL_STEP_PERCENT : Double = 2.0
pub fn accent_css(Rgb, Bool) -> String
pub fn accent_text_color(Rgb, Bool) -> Rgb
pub let black : Rgb
pub fn bundled_form_factor_icon(String, NodeKind) -> String
pub fn clamp_percent(Double) -> Double
pub fn compare_text(String, String) -> Int32
pub fn contrast_ratio(Rgb, Rgb) -> Double
pub fn default_button_icons() -> Array[String]
pub fn device_bus(Node) -> String
pub fn device_icon_chain(Node) -> Array[String]
pub fn diff_rows(Array[Row], Array[Row]) -> Diff
pub fn display_title(Node) -> String
pub fn form_factor_icon(String, NodeKind) -> String
pub fn format_db(Double) -> String
pub fn format_percent(Double) -> String
pub fn format_volume(Array[Double]) -> String
pub fn icon_fallback_device() -> Array[String]
pub fn icon_fallback_stream() -> Array[String]
pub fn is_symbolic_icon(String) -> Bool
pub fn linear_to_db(Double) -> Double?
pub fn linear_to_percent(Double) -> Double
pub fn linked_percent(Array[Double]) -> Double
pub fn meter_level(Double) -> Double
pub fn meter_step(Double, Double) -> Double
pub fn percent_to_linear(Double) -> Double
pub fn readable_fg(Rgb) -> Rgb
pub fn rows(State, Tab) -> Array[Row]
pub fn scale_linked(Array[Double], Double) -> Array[Double]
pub fn should_apply_remote(Int64, Int64, window_us? : Int64) -> Bool
pub fn stream_icon_chain(Node) -> Array[String]
pub fn symbolic(String) -> String
pub fn volume_icon(Double, Bool) -> String
pub fn volume_icon_chain(Double, Bool) -> Array[String]
pub fn wheel_delta_percent(ScrollUnit, Double, Double, Double) -> Double
pub let white : Rgb
pub fn window_bg(Bool) -> Rgb
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) struct AccentColors {
bg : Rgb
fg : Rgb
text : Rgb
border : Rgb
}
pub fn AccentColors::new(Rgb, Bool) -> Self
#derive(Eq, @debug.Debug)
pub(all) enum ColorScheme {
NoPreference
Dark
Light
}
pub fn ColorScheme::from_portal(Int32) -> Self
#derive(Eq, @debug.Debug)
pub(all) struct DeviceChoice {
id : Int32
name : String
label : String
}
#derive(Eq, @debug.Debug)
pub(all) struct Diff {
removed : Array[Int32]
added : Array[Int32]
updated : Array[Int32]
}
#derive(@debug.Debug)
pub(all) enum Event {
Upsert(Node)
Remove(Int32)
Links(Array[Link])
Defaults(sink~ : Int32, source~ : Int32)
Reset
}
#derive(Eq, @debug.Debug)
pub(all) struct Link {
output_node : Int32
input_node : Int32
}
#derive(Eq, @debug.Debug)
pub(all) struct Node {
id : Int32
name : String
description : String
media_class : String
app_name : String
media_name : String
icon_hints : Array[String]
form_factor : String
bus : String
app_binary : String
app_id : String
volumes : Array[Double]
mute : Bool
}
pub fn Node::kind(Self) -> NodeKind
pub fn Node::new(Int32, String, name? : String, description? : String, app_name? : String, media_name? : String, icon_hints? : Array[String], form_factor? : String, bus? : String, app_binary? : String, app_id? : String, volumes? : Array[Double], mute? : Bool) -> Self
#derive(Eq, @debug.Debug)
pub(all) enum NodeKind {
Sink
Source
PlaybackStream
RecordStream
Other
}
pub fn NodeKind::from_media_class(String) -> Self
#derive(Eq, @debug.Debug)
pub(all) struct Rgb {
r : Double
g : Double
b : Double
}
pub fn Rgb::from_portal(Double, Double, Double) -> Self?
pub fn Rgb::luminance(Self) -> Double
pub fn Rgb::mix(Self, Self, Double) -> Self
pub fn Rgb::parse_hex(String) -> Self?
pub fn Rgb::to_hex(Self) -> String
#derive(Eq, @debug.Debug)
pub(all) struct Row {
id : Int32
title : String
subtitle : String
icons : Array[String]
volume_icon : String
volumes : Array[Double]
percent : Double
volume_text : String
mute : Bool
has_volume : Bool
is_default : Bool
choices : Array[DeviceChoice]
current_choice : Int32
}
#derive(Eq, @debug.Debug)
pub(all) enum ScrollUnit {
Wheel
Pixels
}
pub struct SliderWheel {
// private fields
}
pub fn SliderWheel::new() -> Self
pub fn SliderWheel::reset(Self) -> Unit
pub fn SliderWheel::route(Self, ScrollUnit, Double, Double, Int64) -> WheelRoute
pub fn SliderWheel::scroll(Self, ScrollUnit, Double, Double, Int64, Double, Double) -> Double?
pub(all) struct State {
nodes : Map[Int32, Node]
mut links : Array[Link]
mut default_sink : Int32
mut default_source : Int32
}
pub fn State::apply(Self, Event) -> Bool
pub fn State::new() -> Self
pub fn State::nodes_of(Self, NodeKind) -> Array[Node]
pub fn State::stream_device(Self, Int32) -> Int32?
#derive(Eq, @debug.Debug)
pub(all) enum Tab {
Playback
Recording
OutputDevices
InputDevices
}
pub fn Tab::all() -> Array[Self]
pub fn Tab::empty_text(Self) -> String
pub fn Tab::icon(Self) -> String
pub fn Tab::icon_chain(Self) -> Array[String]
pub fn Tab::label(Self) -> String
pub fn Tab::node_kind(Self) -> NodeKind
#derive(Eq, @debug.Debug)
pub(all) enum WheelRoute {
Slider
List
}
// Type aliases
// Traits