input: update keyboard led state

This commit is contained in:
Christian Meissl
2024-01-26 15:13:54 +01:00
committed by Ivan Molodetskikh
parent 51243a0a50
commit 597ea62d17
3 changed files with 28 additions and 3 deletions
Generated
+2 -2
View File
@@ -2716,7 +2716,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c"
source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde"
dependencies = [
"appendlist",
"bitflags 2.4.2",
@@ -2788,7 +2788,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c"
source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde"
dependencies = [
"drm",
"edid-rs",
+15 -1
View File
@@ -11,8 +11,9 @@ use std::thread;
use smithay::backend::allocator::dmabuf::Dmabuf;
use smithay::desktop::{PopupKind, PopupManager};
use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};
use smithay::input::{Seat, SeatHandler, SeatState};
use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
use smithay::output::Output;
use smithay::reexports::input;
use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource;
use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
@@ -73,6 +74,19 @@ impl SeatHandler for State {
set_data_device_focus(dh, seat, client.clone());
set_primary_focus(dh, seat, client);
}
fn led_state_changed(&mut self, _seat: &Seat<Self>, led_state: keyboard::LedState) {
let keyboards = self
.niri
.devices
.iter()
.filter(|device| device.has_capability(input::DeviceCapability::Keyboard))
.cloned();
for mut keyboard in keyboards {
keyboard.led_update(led_state.into());
}
}
}
delegate_seat!(State);
delegate_cursor_shape!(State);
+11
View File
@@ -127,6 +127,17 @@ impl State {
}
}
if device.has_capability(input::DeviceCapability::Keyboard) {
if let Some(led_state) = self
.niri
.seat
.get_keyboard()
.map(|keyboard| keyboard.led_state())
{
device.led_update(led_state.into());
}
}
apply_libinput_settings(&self.niri.config.borrow().input, device);
}
InputEvent::DeviceRemoved { device } => {