@@ -57,7 +57,7 @@ use smithay::{
5757 control:: { connector, crtc, Device as ControlDevice , ModeTypeFlags } ,
5858 Device as _,
5959 } ,
60- input:: Libinput ,
60+ input:: { self , Libinput } ,
6161 nix:: { fcntl:: OFlag , sys:: stat:: dev_t} ,
6262 wayland_protocols:: wp:: {
6363 linux_dmabuf:: zv1:: server:: zwp_linux_dmabuf_feedback_v1,
@@ -97,6 +97,7 @@ const MIN_RENDER_TIME: Duration = Duration::from_millis(3);
9797#[ derive( Debug ) ]
9898pub struct KmsState {
9999 devices : HashMap < DrmNode , Device > ,
100+ pub input_devices : HashMap < String , input:: Device > ,
100101 pub api : GpuManager < GbmGlesBackend < GlowRenderer > > ,
101102 pub primary : DrmNode ,
102103 session : LibSeatSession ,
@@ -171,8 +172,15 @@ pub fn init_backend(
171172 let libinput_event_source = event_loop
172173 . handle ( )
173174 . insert_source ( libinput_backend, move |mut event, _, data| {
174- if let & mut InputEvent :: DeviceAdded { ref mut device } = & mut event {
175+ if let InputEvent :: DeviceAdded { ref mut device } = & mut event {
175176 data. state . common . config . read_device ( device) ;
177+ data. state
178+ . backend
179+ . kms ( )
180+ . input_devices
181+ . insert ( device. name ( ) . into ( ) , device. clone ( ) ) ;
182+ } else if let InputEvent :: DeviceRemoved { device } = & event {
183+ data. state . backend . kms ( ) . input_devices . remove ( device. name ( ) ) ;
176184 }
177185 data. state . process_input_event ( event, true ) ;
178186 for output in data. state . common . shell . outputs ( ) {
@@ -362,6 +370,7 @@ pub fn init_backend(
362370 primary,
363371 session,
364372 devices : HashMap :: new ( ) ,
373+ input_devices : HashMap :: new ( ) ,
365374 } ) ;
366375
367376 // Create relative pointer global
0 commit comments