Feat/mouse wheel acceleration 2672546306030338090 - #1012
Conversation
Implement bounded, velocity-based mouse-wheel acceleration for OpenLogi. Calculates normalized physical wheel velocity in ticks/second and applies a smooth monotonic gain curve bounded by max_gain. Axis state is tracked independently for vertical and horizontal axes, resetting immediately on direction reversal or after a 250ms idle interval.
Implement bounded, velocity-based mouse-wheel acceleration for OpenLogi. Calculates normalized physical wheel velocity in ticks/second and applies a smooth monotonic gain curve bounded by max_gain. Axis state is tracked independently for vertical and horizontal axes, resetting immediately on direction reversal or after a 250ms idle interval. Also adds UI controls in Settings -> General for toggling scroll acceleration.
Greptile SummaryThe PR adds configurable vertical and horizontal mouse-wheel acceleration, publishes the new settings to the agent, and exposes controls in the desktop Settings window.
Confidence Score: 2/5The PR is not yet safe to merge because thumb-wheel scaling, cross-source acceleration state, and non-finite gain handling remain broken. The current worker still applies main-wheel preferences to HID++ thumb-wheel input, shares one acceleration history across independent producers, and permits a NaN maximum gain to reach a panicking clamp operation. Files Needing Attention: crates/openlogi-agent-core/src/runtime/scroll/worker.rs, crates/openlogi-agent-core/src/runtime/scroll/acceleration.rs, crates/openlogi-core/src/config/settings.rs, crates/openlogi-core/src/scroll.rs
|
| Filename | Overview |
|---|---|
| crates/openlogi-agent-core/src/runtime/scroll/worker.rs | Centralizes sensitivity and acceleration in one worker, while the previously reported source-scaling and state-isolation defects remain. |
| crates/openlogi-agent-core/src/runtime/scroll/acceleration.rs | Adds stateful per-axis rate tracking, but the state remains worker-wide and maximum-gain finiteness is not enforced. |
| crates/openlogi-core/src/config/settings.rs | Adds persisted acceleration preferences without validating non-finite floating-point bounds. |
| crates/openlogi-core/src/scroll.rs | Adds the acceleration curve, whose clamp still receives an unvalidated maximum bound. |
| crates/openlogi-desktop/src/windows/settings.rs | Adds slider state and handlers for the new acceleration controls. |
| crates/openlogi-desktop/src/windows/settings/general.rs | Adds the user-facing acceleration switches, sliders, reset controls, and explanatory graph. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[Desktop acceleration controls] --> Config[Persisted AppSettings]
Config --> Orchestrator[Agent config reload]
Orchestrator --> Preferences[Shared scroll preferences]
Hook[OS wheel input] --> Worker[Scroll worker]
HIDPP[HID++ thumb-wheel input] --> Worker
Preferences --> Worker
Worker --> Acceleration[Acceleration engine]
Acceleration --> Injection[Smooth or direct scroll injection]
Reviews (3): Last reviewed commit: "feat: implement mouse-wheel acceleration..." | Re-trigger Greptile
| let scaled_impulse = WheelDelta { | ||
| x: input.impulse.x * gain_x, | ||
| y: input.impulse.y * prefs.vertical_sensitivity.scroll_multiplier() * gain_y, |
There was a problem hiding this comment.
Thumb wheel receives main-wheel scaling
When a diverted HID++ thumb wheel emits vertical scrolling with smoothing enabled, the shared worker applies the traditional-wheel sensitivity and acceleration to its already thumb-wheel-scaled impulse, causing incorrect scroll distance and acceleration.
Knowledge Base Used: Core domain and configuration
| let mut engine = ScrollEngine::default(); | ||
| let mut accel_engine = super::ScrollAccelerationEngine::default(); |
There was a problem hiding this comment.
Acceleration state crosses input sources
If two devices or hook threads submit same-axis events within the acceleration timeout, both update this single engine, so a fast scroll from one producer accelerates or resets a deliberate scroll from another producer.
Knowledge Base Used: Background agent service
| /// Maximum upper bound for vertical acceleration gain. | ||
| #[serde(default = "default_vertical_max_gain")] | ||
| pub vertical_max_gain: f64, | ||
| /// Whether horizontal mouse-wheel acceleration is enabled. | ||
| #[serde(default)] | ||
| pub horizontal_acceleration_enabled: bool, | ||
| /// Horizontal acceleration strength multiplier. | ||
| #[serde(default = "default_acceleration_factor")] | ||
| pub horizontal_acceleration: f64, | ||
| /// Maximum upper bound for horizontal acceleration gain. | ||
| #[serde(default = "default_horizontal_max_gain")] | ||
| pub horizontal_max_gain: f64, |
There was a problem hiding this comment.
When a user-edited config supplies nan for either maximum gain, the unvalidated value reaches f64::clamp as its upper bound and panics the scroll worker, leaving configured smoothing and acceleration unavailable until restart.
Knowledge Base Used: Core domain and configuration
Implement bounded velocity-based scroll acceleration and settings UI. Calculates physical wheel rate in ticks/second using a shared pure gain curve function. Adds independent vertical and horizontal acceleration controls, GPUI curve graph visualization, state setters/resets, and unit tests.
Implement bounded velocity-based scroll acceleration and settings UI. Calculates physical wheel rate in ticks/second using a shared pure gain curve function. Adds independent vertical and horizontal acceleration controls, GPUI curve graph visualization, state setters/resets, and unit tests.
Added UI elements for scroll adjustment