1
0
Fork 0
forked from wry/wry

config: allow setting per-device scroll wheel speed

This commit is contained in:
Julian Orth 2022-05-27 16:00:16 +02:00
parent 50c87d6da7
commit c0afc5cf2a
12 changed files with 78 additions and 16 deletions

View file

@ -532,6 +532,10 @@ impl Client {
self.send(&ClientMessage::SetTransformMatrix { device, matrix })
}
pub fn set_px_per_wheel_scroll(&self, device: InputDevice, px: f64) {
self.send(&ClientMessage::SetPxPerWheelScroll { device, px })
}
pub fn device_name(&self, device: InputDevice) -> String {
let res = self.send_with_response(&ClientMessage::GetDeviceName { device });
get_response!(res, String::new(), GetDeviceName { name });

View file

@ -270,6 +270,10 @@ pub enum ClientMessage<'a> {
SetFont {
font: &'a str,
},
SetPxPerWheelScroll {
device: InputDevice,
px: f64,
},
}
#[derive(Encode, Decode, Debug)]

View file

@ -71,6 +71,18 @@ impl InputDevice {
pub fn name(self) -> String {
get!(String::new()).device_name(self)
}
/// Sets how many pixel to scroll per scroll wheel dedent.
///
/// Default: `15.0`
///
/// This setting has no effect on non-wheel input such as touchpads.
///
/// Some mouse wheels support high-resolution scrolling without discrete steps. In
/// this case a value proportional to this setting will be used.
pub fn set_px_per_wheel_scroll(self, px: f64) {
get!().set_px_per_wheel_scroll(self, px);
}
}
/// A seat.