1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
}