mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Set some touchpad input settings
This commit is contained in:
@@ -5,6 +5,7 @@ use smithay::backend::input::{
|
|||||||
KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,
|
KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,
|
||||||
TabletToolEvent, TabletToolTipEvent, TabletToolTipState,
|
TabletToolEvent, TabletToolTipEvent, TabletToolTipState,
|
||||||
};
|
};
|
||||||
|
use smithay::backend::libinput::LibinputInputBackend;
|
||||||
use smithay::input::keyboard::{keysyms, FilterResult, KeysymHandle, ModifiersState};
|
use smithay::input::keyboard::{keysyms, FilterResult, KeysymHandle, ModifiersState};
|
||||||
use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotionEvent};
|
use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotionEvent};
|
||||||
use smithay::utils::SERIAL_COUNTER;
|
use smithay::utils::SERIAL_COUNTER;
|
||||||
@@ -414,4 +415,16 @@ impl Niri {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn process_libinput_event(&mut self, event: &mut InputEvent<LibinputInputBackend>) {
|
||||||
|
if let InputEvent::DeviceAdded { device } = event {
|
||||||
|
// According to Mutter code, this setting is specific to touchpads.
|
||||||
|
let is_touchpad = device.config_tap_finger_count() > 0;
|
||||||
|
if is_touchpad {
|
||||||
|
let _ = device.config_tap_set_enabled(true);
|
||||||
|
let _ = device.config_scroll_set_natural_scroll_enabled(true);
|
||||||
|
let _ = device.config_accel_set_speed(0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -122,9 +122,10 @@ impl Tty {
|
|||||||
|
|
||||||
let input_backend = LibinputInputBackend::new(libinput.clone());
|
let input_backend = LibinputInputBackend::new(libinput.clone());
|
||||||
event_loop
|
event_loop
|
||||||
.insert_source(input_backend, |event, _, data| {
|
.insert_source(input_backend, |mut event, _, data| {
|
||||||
let tty = data.tty.as_mut().unwrap();
|
let tty = data.tty.as_mut().unwrap();
|
||||||
let mut change_vt = |vt| tty.change_vt(vt);
|
let mut change_vt = |vt| tty.change_vt(vt);
|
||||||
|
data.niri.process_libinput_event(&mut event);
|
||||||
data.niri
|
data.niri
|
||||||
.process_input_event(&mut change_vt, CompositorMod::Super, event);
|
.process_input_event(&mut change_vt, CompositorMod::Super, event);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user