pub fn register_kbd_from_rmlvo<ID: 'static>(evqh: &mut EventQueueHandle, kbd: &WlKeyboard,
                                            implem: MappedKeyboardImplementation<ID>, idata: ID,
                                            rmlvo: RMLVO)
                                            -> Result<(), MappedKeyboardError> {
    let mut mapped_kbd = KbState::new()?;

    fn to_cstring(s: Option<String>) -> Result<Option<CString>, MappedKeyboardError> {
        s.map_or(Ok(None), |s| CString::new(s).map(Option::Some))
            .map_err(|_| MappedKeyboardError::BadNames)
    }

    let rules = to_cstring(rmlvo.rules)?;
    let model = to_cstring(rmlvo.model)?;
    let layout = to_cstring(rmlvo.layout)?;
    let variant = to_cstring(rmlvo.variant)?;
    let options = to_cstring(rmlvo.options)?;

    let xkb_names = ffi::xkb_rule_names {
        rules: rules.map_or(ptr::null(), |s| s.as_ptr()),
        model: model.map_or(ptr::null(), |s| s.as_ptr()),
        layout: layout.map_or(ptr::null(), |s| s.as_ptr()),
        variant: variant.map_or(ptr::null(), |s| s.as_ptr()),
        options: options.map_or(ptr::null(), |s| s.as_ptr()),
    };

    unsafe {
        mapped_kbd.init_with_rmlvo(xkb_names)?;
    }

    mapped_kbd.locked = true;

    evqh.register(
        kbd,
        wl_keyboard_implementation(),
        (mapped_kbd, implem, idata),
    );
    Ok(())
}
/// Register a keyboard with the implementation provided by this crate
///
/// This requires you to provide an implementation and its implementation data
/// to receive the events after they have been interpreted with the keymap.
///
/// The keymap will be loaded from the provided RMLVO rules. Any keymap provided
/// by the compositor will be ignored.
///
/// Returns an error if xkbcommon could not be initialized.
Register a keyboard with the implementation provided by this crate
This requires you to provide an implementation and its implementation data
to receive the events after they have been interpreted with the keymap.

The keymap will be loaded from the provided RMLVO rules. Any keymap provided
by the compositor will be ignored.

Returns an error if xkbcommon could not be initialized.
Register a keyboard with the implementation provided by this crate This requires you to provide an implementation and its implementation data to receive the events after they have been interpreted with the keymap . The keymap will be loaded from the provided RMLVO rules . Any keymap provided by the compositor will be ignored . Returns an error if xkbcommon could not be initialized .
pub fn register_kbd_from_rmlvo<ID: 'static>(evqh: &mut EventQueueHandle, kbd: &WlKeyboard,
                                            implem: MappedKeyboardImplementation<ID>, idata: ID,
                                            rmlvo: RMLVO)
                                            -> Result<(), MappedKeyboardError> {
    let mut mapped_kbd = KbState::new()?;
    fn to_cstring(s: Option<String>) -> Result<Option<CString>, MappedKeyboardError> {
        s.map_or(Ok(None), |s| CString::new(s).map(Option::Some))
            .map_err(|_| MappedKeyboardError::BadNames)
    }
    let rules = to_cstring(rmlvo.rules)?;
    let model = to_cstring(rmlvo.model)?;
    let layout = to_cstring(rmlvo.layout)?;
    let variant = to_cstring(rmlvo.variant)?;
    let options = to_cstring(rmlvo.options)?;
    let xkb_names = ffi::xkb_rule_names {
        rules: rules.map_or(ptr::null(), |s| s.as_ptr()),
        model: model.map_or(ptr::null(), |s| s.as_ptr()),
        layout: layout.map_or(ptr::null(), |s| s.as_ptr()),
        variant: variant.map_or(ptr::null(), |s| s.as_ptr()),
        options: options.map_or(ptr::null(), |s| s.as_ptr()),
    };
    unsafe {
        mapped_kbd.init_with_rmlvo(xkb_names)?;
    }
    mapped_kbd.locked = true;
    evqh.register(
        kbd,
        wl_keyboard_implementation(),
        (mapped_kbd, implem, idata),
    );
    Ok(())
}
pub fn register_kbd_from_rmlvo < ID : ' static > ( evqh : & mut EventQueueHandle , kbd : & WlKeyboard , implem : MappedKeyboardImplementation < ID > , idata : ID , rmlvo : RMLVO ) -> Result < ( ) , MappedKeyboardError > { let mut mapped_kbd = KbState :: new ( ) ? ; fn to_cstring ( s : Option < String > ) -> Result < Option < CString > , MappedKeyboardError > { s . map_or ( Ok ( None ) , | s | CString :: new ( s ) . map ( Option :: Some ) ) . map_err ( | _ | MappedKeyboardError :: BadNames ) } let rules = to_cstring ( rmlvo . rules ) ? ; let model = to_cstring ( rmlvo . model ) ? ; let layout = to_cstring ( rmlvo . layout ) ? ; let variant = to_cstring ( rmlvo . variant ) ? ; let options = to_cstring ( rmlvo . options ) ? ; let xkb_names = ffi :: xkb_rule_names { rules : rules . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , model : model . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , layout : layout . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , variant : variant . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , options : options . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , } ; unsafe { mapped_kbd . init_with_rmlvo ( xkb_names ) ? ; } mapped_kbd . locked = true ; evqh . register ( kbd , wl_keyboard_implementation ( ) , ( mapped_kbd , implem , idata ) , ) ; Ok ( ( ) ) }
Register a keyboard with the implementation provided by this crate
This requires you to provide an implementation and its implementation data
to receive the events after they have been interpreted with the keymap.
Register a keyboard with the implementation provided by this crate This requires you to provide an implementation and its implementation data to receive the events after they have been interpreted with the keymap .
evqh
&mut EventQueueHandle
kbd
&WlKeyboard
implem
MappedKeyboardImplementation<ID>
idata
ID
rmlvo
RMLVO
evqh
&mut EventQueueHandle
kbd
&WlKeyboard
implem
MappedKeyboardImplementation<ID>
idata
ID
rmlvo
RMLVO