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

@ -1,15 +1,17 @@
use {
crate::{
backend::InputDevice,
ifs::wl_seat::PX_PER_SCROLL,
state::{DeviceHandlerData, InputDeviceData, State},
utils::asyncevent::AsyncEvent,
},
std::rc::Rc,
std::{cell::Cell, rc::Rc},
};
pub fn handle(state: &Rc<State>, dev: Rc<dyn InputDevice>) {
let data = Rc::new(DeviceHandlerData {
seat: Default::default(),
px_per_scroll_wheel: Cell::new(PX_PER_SCROLL),
device: dev.clone(),
});
let ae = Rc::new(AsyncEvent::default());
@ -54,7 +56,7 @@ impl DeviceHandler {
if let Some(seat) = self.data.seat.get() {
let mut any_events = false;
while let Some(event) = self.dev.event() {
seat.event(event);
seat.event(&self.data, event);
any_events = true;
}
if any_events {