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>
This commit is contained in:
1 parent
0760d7ba6c
commit
cff5f49dc3
9 files changed
+511
-15
No files matched your search
@@ -12,6 +12,8 @@ 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
|
||||
@@ -22,6 +24,8 @@ 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
|
||||
@@ -88,6 +92,8 @@ 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
|
||||
@@ -199,6 +205,20 @@ pub(all) struct Row {
|
||||
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]
|
||||
@@ -224,6 +244,12 @@ 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
|
||||
Reference in new issue
Block a user