mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Fix scrolling not working with missing mouse config
This commit is contained in:
@@ -188,8 +188,8 @@ pub struct Touchpad {
|
||||
pub disabled_on_external_mouse: bool,
|
||||
#[knuffel(child)]
|
||||
pub middle_emulation: bool,
|
||||
#[knuffel(child, unwrap(argument), default = FloatOrInt(1.0))]
|
||||
pub scroll_factor: FloatOrInt<0, 100>,
|
||||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_factor: Option<FloatOrInt<0, 100>>,
|
||||
}
|
||||
|
||||
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
|
||||
@@ -210,8 +210,8 @@ pub struct Mouse {
|
||||
pub left_handed: bool,
|
||||
#[knuffel(child)]
|
||||
pub middle_emulation: bool,
|
||||
#[knuffel(child, unwrap(argument), default = FloatOrInt(1.0))]
|
||||
pub scroll_factor: FloatOrInt<0, 100>,
|
||||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_factor: Option<FloatOrInt<0, 100>>,
|
||||
}
|
||||
|
||||
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
|
||||
@@ -3183,7 +3183,7 @@ mod tests {
|
||||
left_handed: false,
|
||||
disabled_on_external_mouse: true,
|
||||
middle_emulation: false,
|
||||
scroll_factor: FloatOrInt(0.9),
|
||||
scroll_factor: Some(FloatOrInt(0.9)),
|
||||
},
|
||||
mouse: Mouse {
|
||||
off: false,
|
||||
@@ -3194,7 +3194,7 @@ mod tests {
|
||||
scroll_button: Some(273),
|
||||
left_handed: false,
|
||||
middle_emulation: true,
|
||||
scroll_factor: FloatOrInt(0.2),
|
||||
scroll_factor: Some(FloatOrInt(0.2)),
|
||||
},
|
||||
trackpoint: Trackpoint {
|
||||
off: true,
|
||||
|
||||
+4
-3
@@ -1882,10 +1882,11 @@ impl State {
|
||||
}
|
||||
|
||||
let scroll_factor = match source {
|
||||
AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor.0,
|
||||
AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor.0,
|
||||
_ => 1.0,
|
||||
AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor,
|
||||
AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor,
|
||||
_ => None,
|
||||
};
|
||||
let scroll_factor = scroll_factor.map(|x| x.0).unwrap_or(1.);
|
||||
|
||||
let horizontal_amount = horizontal_amount.unwrap_or_else(|| {
|
||||
// Winit backend, discrete scrolling.
|
||||
|
||||
Reference in New Issue
Block a user