kbvm::xkb::keymap

Struct KeyTypeMapping

Source
pub struct KeyTypeMapping { /* private fields */ }
Expand description

A key-type mapping.

§Example

xkb_types {
    type "X" {
        modifiers = Shift+Mod1;
        map[Shift] = Level2;
        map[Mod1] = Level2;
    };
};

This object might refer to either map[Shift] or map[Mod1].

Implementations§

Source§

impl KeyTypeMapping

Source

pub fn mask(&self) -> ModifierMask

Returns the modifier mask of this mapping.

After masking with the type mask, the effective modifiers must match this mask exactly for the mapping to be applicable.

§Example
xkb_types {
    type "X" {
        modifiers = Shift+Mod1;
        map[Shift] = Level2;
        map[Mod1] = Level2;
    };
};

If this mapping is map[Shift], then this function returns ModifierMask::SHIFT.

Source

pub fn preserved(&self) -> ModifierMask

Returns the preserved modifiers of this mapping.

If this mapping is applicable, then the preserved modifiers are not consumed by the mapping and might be used for keyboard shortcuts or keysym transformations.

§Example
xkb_types {
    type "X" {
        modifiers = Control+Shift;
        map[Control+Shift] = Level2;
        preserve[Control+Shift] = Control;
    };
};

If this mapping is map[Control+Shift], then function returns ModifierMask::CONTROL.

Source

pub fn consumed(&self) -> ModifierMask

Returns the consumed modifiers of this mapping.

If this mapping is applicable, then the consumed modifiers should no longer be considered for keyboard shortcuts and keysym transformations.

§Example
xkb_types {
    type "X" {
        modifiers = Control+Shift;
        map[Control+Shift] = Level2;
        preserve[Control+Shift] = Control;
    };
};

If this mapping is map[Control+Shift], then function returns ModifierMask::SHIFT.

Source

pub fn level(&self) -> usize

Returns the 0-based level that this mapping maps to.

§Example
xkb_types {
    type "X" {
        modifiers = Shift;
        map[Shift] = Level2;
    };
};

If this mapping is map[Shift], then function returns 1.

Trait Implementations§

Source§

impl Debug for KeyTypeMapping

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for KeyTypeMapping

Source§

fn eq(&self, other: &KeyTypeMapping) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for KeyTypeMapping

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Lhs, Rhs> IsntPartialEqExt<Lhs, Rhs> for Lhs
where Lhs: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

Source§

fn not_eq(&self, other: &Rhs) -> bool

The negation of eq
Source§

fn not_ne(&self, other: &Rhs) -> bool

The negation of ne
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.