diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/input.rs | 2 | ||||
| -rw-r--r-- | src/niri.rs | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/input.rs b/src/input.rs index 0eb90c76..293bda93 100644 --- a/src/input.rs +++ b/src/input.rs @@ -89,6 +89,7 @@ impl State { match event { InputEvent::DeviceAdded { device } => { + self.niri.devices.insert(device.clone()); if device.has_capability(input::DeviceCapability::TabletTool) { match device.size() { @@ -107,6 +108,7 @@ impl State { } InputEvent::DeviceRemoved { device } => { self.niri.tablets.remove(device); + self.niri.devices.remove(device); } _ => (), } diff --git a/src/niri.rs b/src/niri.rs index 2a4cc089..4bd99e25 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -96,7 +96,7 @@ use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri}; use crate::dbus::mutter_screen_cast::{self, ScreenCastToNiri}; use crate::frame_clock::FrameClock; use crate::handlers::configure_lock_surface; -use crate::input::TabletData; +use crate::input::{apply_libinput_settings, TabletData}; use crate::layout::{Layout, MonitorRenderElement}; use crate::pw_utils::{Cast, PipeWire}; use crate::render_helpers::{NiriRenderer, PrimaryGpuTextureRenderElement}; @@ -135,6 +135,7 @@ pub struct Niri { // When false, we're idling with monitors powered off. pub monitors_active: bool, + pub devices: HashSet<input::Device>, pub tablets: HashMap<input::Device, TabletData>, // Smithay state. @@ -542,6 +543,7 @@ impl State { animation::ANIMATION_SLOWDOWN.store(config.debug.animation_slowdown, Ordering::Relaxed); let mut reload_xkb = None; + let mut libinput_config_changed = false; let mut output_config_changed = false; let mut old_config = self.niri.config.borrow_mut(); @@ -569,6 +571,12 @@ impl State { ); } + if config.input.touchpad != old_config.input.touchpad + || config.input.mouse != old_config.input.mouse + { + libinput_config_changed = true; + } + if config.outputs != old_config.outputs { output_config_changed = true; } @@ -586,6 +594,13 @@ impl State { } } + if libinput_config_changed { + let config = self.niri.config.borrow(); + for mut device in self.niri.devices.iter().cloned() { + apply_libinput_settings(&config.input, &mut device); + } + } + if output_config_changed { let mut resized_outputs = vec![]; for output in self.niri.global_space.outputs() { @@ -620,7 +635,6 @@ impl State { } self.niri.queue_redraw_all(); - // FIXME: apply libinput device settings. // FIXME: apply xdg decoration settings. } @@ -878,6 +892,7 @@ impl Niri { unmapped_windows: HashMap::new(), monitors_active: true, + devices: HashSet::new(), tablets: HashMap::new(), compositor_state, |
