forge
Explore
Log in

Don't you dare go Hollow

input: update keyboard led state

Browse files at this commit

597ea62d179e51e45cbdd99085795567322ff2f7Christian MeisslParent: 51243a0
Cargo.lockmodified+2 -2
@@ -2716,7 +2716,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
2716 [[package]]2716 [[package]]
2717 name = "smithay"2717 name = "smithay"
2718 version = "0.3.0"2718 version = "0.3.0"
2719-source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c"2719+source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde"
2720 dependencies = [2720 dependencies = [
2721 "appendlist",2721 "appendlist",
2722 "bitflags 2.4.2",2722 "bitflags 2.4.2",
@@ -2788,7 +2788,7 @@ dependencies = [
2788 [[package]]2788 [[package]]
2789 name = "smithay-drm-extras"2789 name = "smithay-drm-extras"
2790 version = "0.1.0"2790 version = "0.1.0"
2791-source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c"2791+source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde"
2792 dependencies = [2792 dependencies = [
2793 "drm",2793 "drm",
2794 "edid-rs",2794 "edid-rs",
src/handlers/mod.rsmodified+15 -1
@@ -11,8 +11,9 @@ use std::thread;
11 use smithay::backend::allocator::dmabuf::Dmabuf;11 use smithay::backend::allocator::dmabuf::Dmabuf;
12 use smithay::desktop::{PopupKind, PopupManager};12 use smithay::desktop::{PopupKind, PopupManager};
13 use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};13 use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};
14-use smithay::input::{Seat, SeatHandler, SeatState};14+use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
15 use smithay::output::Output;15 use smithay::output::Output;
16+use smithay::reexports::input;
16 use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource;17 use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource;
17 use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;18 use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;
18 use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;19 use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
@@ -73,6 +74,19 @@ impl SeatHandler for State {
73 set_data_device_focus(dh, seat, client.clone());74 set_data_device_focus(dh, seat, client.clone());
74 set_primary_focus(dh, seat, client);75 set_primary_focus(dh, seat, client);
75 }76 }
77+
78+ fn led_state_changed(&mut self, _seat: &Seat<Self>, led_state: keyboard::LedState) {
79+ let keyboards = self
80+ .niri
81+ .devices
82+ .iter()
83+ .filter(|device| device.has_capability(input::DeviceCapability::Keyboard))
84+ .cloned();
85+
86+ for mut keyboard in keyboards {
87+ keyboard.led_update(led_state.into());
88+ }
89+ }
76 }90 }
77 delegate_seat!(State);91 delegate_seat!(State);
78 delegate_cursor_shape!(State);92 delegate_cursor_shape!(State);
src/input.rsmodified+11 -0
@@ -127,6 +127,17 @@ impl State {
127 }127 }
128 }128 }
129 129
130+ if device.has_capability(input::DeviceCapability::Keyboard) {
131+ if let Some(led_state) = self
132+ .niri
133+ .seat
134+ .get_keyboard()
135+ .map(|keyboard| keyboard.led_state())
136+ {
137+ device.led_update(led_state.into());
138+ }
139+ }
140+
130 apply_libinput_settings(&self.niri.config.borrow().input, device);141 apply_libinput_settings(&self.niri.config.borrow().input, device);
131 }142 }
132 InputEvent::DeviceRemoved { device } => {143 InputEvent::DeviceRemoved { device } => {