stabilize live speed indicator and normalize hi-res wheel handling
This commit is contained in:
+13
-13
@@ -277,7 +277,18 @@ fn transform_event(
|
||||
.max(0.001);
|
||||
state.last_scroll_event_at = Some(now);
|
||||
|
||||
let speed = (value.abs() as f64) / dt;
|
||||
let axis_unit = if axis == RelativeAxisCode::REL_WHEEL_HI_RES
|
||||
|| axis == RelativeAxisCode::REL_HWHEEL_HI_RES
|
||||
{
|
||||
120.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
// Normalize hi-res wheel units (120 per detent) to "detent-equivalent"
|
||||
// speed so tuning behaves similarly across REL_WHEEL and REL_WHEEL_HI_RES.
|
||||
let normalized_value = (value as f64) / axis_unit;
|
||||
let speed = normalized_value.abs() / dt;
|
||||
let (gain_x, gain_y) = sensitivity(speed, *mode, params);
|
||||
let gain = if axis == RelativeAxisCode::REL_HWHEEL
|
||||
|| axis == RelativeAxisCode::REL_HWHEEL_HI_RES
|
||||
@@ -335,17 +346,6 @@ fn stats_path() -> PathBuf {
|
||||
return PathBuf::from(path);
|
||||
}
|
||||
|
||||
if let Ok(runtime_dir) = std::env::var("XDG_RUNTIME_DIR") {
|
||||
return PathBuf::from(runtime_dir).join("gsf-speed.txt");
|
||||
}
|
||||
|
||||
if let Ok(home) = std::env::var("HOME") {
|
||||
return PathBuf::from(home)
|
||||
.join(".local")
|
||||
.join("state")
|
||||
.join("gsf")
|
||||
.join("speed.txt");
|
||||
}
|
||||
|
||||
// Keep default shared across sudo/non-sudo runs.
|
||||
PathBuf::from("/tmp/gsf-speed.txt")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user