Struct ncinput

Source
#[repr(C)]
pub struct ncinput { pub id: u32, pub y: c_int, pub x: c_int, pub utf8: [c_char; 5], pub alt: bool, pub shift: bool, pub ctrl: bool, pub evtype: ncintype_e, pub modifiers: c_uint, pub ypx: c_int, pub xpx: c_int, pub eff_text: [u32; 4], }
Expand description

An input event. Cell coordinates are currently defined only for mouse events. It is not guaranteed that we can set the modifiers for a given ncinput. We encompass single Unicode codepoints, not complete EGCs. FIXME for abi4, combine the bools into |modifiers|

Fields§

§id: u32

Unicode codepoint or synthesized NCKEY event

§y: c_int

y/x cell coordinate of event, -1 for undefined

§x: c_int

y/x cell coordinate of event, -1 for undefined

§utf8: [c_char; 5]

utf8 representation, if one exists

§alt: bool

was alt held?

§shift: bool

was shift held?

§ctrl: bool

was ctrl held?

§evtype: ncintype_e

END DEPRECATION

§modifiers: c_uint

bitmask over NCKEY_MOD_*

§ypx: c_int

pixel offsets within cell, -1 for undefined

§xpx: c_int

pixel offsets within cell, -1 for undefined

§eff_text: [u32; 4]

Effective

Implementations§

Source§

impl ncinput

§Constructors

Source

pub fn new_empty() -> NcInput

New empty NcInput.

Source

pub fn new(id: char) -> NcInput

New NcInput.

Source

pub fn with_alt(id: char) -> NcInput

New NcInput with alt key.

Source

pub fn with_shift(id: char) -> NcInput

New NcInput with shift key.

Source

pub fn with_ctrl(id: char) -> NcInput

New NcInput with ctrl key.

Source

pub fn with_all_args( id: char, x: Option<u32>, y: Option<u32>, modifiers: NcKeyMod, evtype: NcInputType, ) -> NcInput

New NcInput, expecting all the arguments (except utf8).

Source§

impl ncinput

§Methods

Source

pub fn char(&self) -> Option<char>

Returns the char from the utf8 representation of the input.

Source

pub fn nomod_p(&self) -> bool

Returns true if there are no modifiers present.

C style function: ncinput_nomod_p().

Source

pub fn shift_p(&self) -> bool

Returns true if the Shift modifier is present.

C style function: ncinput_shift_p().

Source

pub fn alt_p(&self) -> bool

Returns true if the Alt modifier is present.

C style function: ncinput_alt_p().

Source

pub fn ctrl_p(&self) -> bool

Returns true if the Ctrl modifier is present.

C style function: ncinput_ctrl_p().

Source

pub fn meta_p(&self) -> bool

Returns true if the Meta modifier is present.

C style function: ncinput_meta_p().

Source

pub fn super_p(&self) -> bool

Returns true if the Super modifier is present.

C style function: ncinput_super_p().

Source

pub fn hyper_p(&self) -> bool

Returns true if the Hyper modifier is present.

C style function: ncinput_hyper_p().

Source

pub fn capslock_p(&self) -> bool

Returns true if the CapsLock modifier is present.

C style function: ncinput_capslock_p().

Source

pub fn numlock_p(&self) -> bool

Returns true if the NumLock modifier is present.

C style function: ncinput_numlock_p().

Source

pub fn equal_p(&self, other: &NcInput) -> bool

Returns true if both NcInputs are equal.

C style function: ncinput_equal_p().

Trait Implementations§

Source§

impl Clone for ncinput

Source§

fn clone(&self) -> ncinput

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ncinput

Source§

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

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

impl Default for ncinput

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&mut ncinput> for NcReceived

Source§

fn from(i: &mut NcInput) -> Self

Converts to this type from the input type.
Source§

impl From<&ncinput> for NcReceived

Source§

fn from(i: &NcInput) -> Self

Converts to this type from the input type.
Source§

impl From<ncinput> for NcReceived

Source§

fn from(i: NcInput) -> Self

Converts to this type from the input type.
Source§

impl Hash for ncinput

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Copy for ncinput

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.