use crate::{NcInput, NcInputType, NcKeyMod};
pub fn ncinput_nomod_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).none_p()
}
pub fn ncinput_shift_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).shift_p()
}
pub fn ncinput_alt_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).alt_p()
}
pub fn ncinput_ctrl_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).ctrl_p()
}
pub fn ncinput_meta_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).meta_p()
}
pub fn ncinput_super_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).super_p()
}
pub fn ncinput_hyper_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).hyper_p()
}
pub fn ncinput_capslock_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).capslock_p()
}
pub fn ncinput_numlock_p(input: &NcInput) -> bool {
NcKeyMod::from(input.modifiers).numlock_p()
}
pub fn ncinput_equal_p(n1: &NcInput, n2: &NcInput) -> bool {
if n1.id != n2.id {
return false;
}
if n1.y != n2.y || n1.x != n2.x {
return false;
}
if (n1.modifiers & !(NcKeyMod::CapsLock | NcKeyMod::NumLock))
!= (n2.modifiers & !(NcKeyMod::CapsLock | NcKeyMod::NumLock))
{
return false;
}
if n1.evtype != n2.evtype
&& ((n1.evtype != NcInputType::Unknown as u32 && n1.evtype != NcInputType::Press as u32)
|| (n2.evtype != NcInputType::Unknown as u32 && n2.evtype != NcInputType::Press as u32))
{
return false;
}
if n1.ypx != n2.ypx || n1.xpx != n2.xpx {
return false;
}
true
}