pub(crate) fn new_kbd(&self, kbd: WlKeyboard) {
        trace!(self.arc.logger, "Sending keymap to client");

        // prepare a tempfile with the keymap, to send it to the client
        let ret = tempfile().and_then(|mut f| {
            f.write_all(self.arc.keymap.as_bytes())?;
            f.flush()?;
            kbd.keymap(
                KeymapFormat::XkbV1,
                f.as_raw_fd(),
                self.arc.keymap.as_bytes().len() as u32,
            );
            Ok(())
        });

        if let Err(e) = ret {
            warn!(self.arc.logger,
                "Failed write keymap to client in a tempfile";
                "err" => format!("{:?}", e)
            );
            return;
        };

        let mut guard = self.arc.internal.borrow_mut();
        if kbd.as_ref().version() >= 4 {
            kbd.repeat_info(guard.repeat_rate, guard.repeat_delay);
        }
        guard.known_kbds.push(kbd);
    }
/// Register a new keyboard to this handler
///
/// The keymap will automatically be sent to it
///
/// This should be done first, before anything else is done with this keyboard.
Register a new keyboard to this handler
The keymap will automatically be sent to it

This should be done first, before anything else is done with this keyboard.
Register a new keyboard to this handler The keymap will automatically be sent to it This should be done first before anything else is done with this keyboard .
pub(crate) fn new_kbd(&self, kbd: WlKeyboard) {
        trace!(self.arc.logger, "Sending keymap to client");
        // prepare a tempfile with the keymap, to send it to the client
        let ret = tempfile().and_then(|mut f| {
            f.write_all(self.arc.keymap.as_bytes())?;
            f.flush()?;
            kbd.keymap(
                KeymapFormat::XkbV1,
                f.as_raw_fd(),
                self.arc.keymap.as_bytes().len() as u32,
            );
            Ok(())
        });
        if let Err(e) = ret {
            warn!(self.arc.logger,
                "Failed write keymap to client in a tempfile";
                "err" => format!("{:?}", e)
            );
            return;
        };
        let mut guard = self.arc.internal.borrow_mut();
        if kbd.as_ref().version() >= 4 {
            kbd.repeat_info(guard.repeat_rate, guard.repeat_delay);
        }
        guard.known_kbds.push(kbd);
    }
pub ( crate ) fn new_kbd ( & self , kbd : WlKeyboard ) { trace ! ( self arc logger " " ) ; // prepare a tempfile with the keymap, to send it to the client let ret = tempfile ( ) . and_then ( | mut f | { f . write_all ( self . arc . keymap . as_bytes ( ) ) ? ; f . flush ( ) ? ; kbd . keymap ( KeymapFormat :: XkbV1 , f . as_raw_fd ( ) , self . arc . keymap . as_bytes ( ) . len ( ) as u32 , ) ; Ok ( ( ) ) } ) ; if let Err ( e ) = ret { warn ! ( self arc logger " " " " format ( " " e ) ) ; return ; } ; let mut guard = self . arc . internal . borrow_mut ( ) ; if kbd . as_ref ( ) . version ( ) >= 4 { kbd . repeat_info ( guard . repeat_rate , guard . repeat_delay ) ; } guard . known_kbds . push ( kbd ) ; }
Register a new keyboard to this handler
The keymap will automatically be sent to it
Register a new keyboard to this handler The keymap will automatically be sent to it
&self
kbd
WlKeyboard
&self
kbd
WlKeyboard