denise_evdev/codes.rs
1//! The subset of `linux/input-event-codes.h` this backend needs.
2//!
3//! Spelled out rather than pulled from a binding crate so the translation layer
4//! stays platform-independent and testable off Linux.
5
6/// Event types.
7pub mod ev {
8 /// Frame separator.
9 pub const SYN: u16 = 0x00;
10 /// Keys and buttons.
11 pub const KEY: u16 = 0x01;
12 /// Relative axes.
13 pub const REL: u16 = 0x02;
14 /// Absolute axes.
15 pub const ABS: u16 = 0x03;
16}
17
18/// `EV_SYN` codes.
19pub mod syn {
20 /// End of an event frame.
21 pub const REPORT: u16 = 0;
22 /// The kernel dropped events; state must be resynchronised.
23 pub const DROPPED: u16 = 3;
24}
25
26/// `EV_REL` codes.
27pub mod rel {
28 /// Horizontal motion.
29 pub const X: u16 = 0x00;
30 /// Vertical motion.
31 pub const Y: u16 = 0x01;
32 /// Horizontal wheel, in detents.
33 pub const HWHEEL: u16 = 0x06;
34 /// Vertical wheel, in detents.
35 pub const WHEEL: u16 = 0x08;
36}
37
38/// `EV_ABS` codes.
39pub mod abs {
40 /// Absolute horizontal position.
41 pub const X: u16 = 0x00;
42 /// Absolute vertical position.
43 pub const Y: u16 = 0x01;
44 /// Selects the multitouch slot subsequent events apply to.
45 pub const MT_SLOT: u16 = 0x2f;
46 /// Contact horizontal position.
47 pub const MT_POSITION_X: u16 = 0x35;
48 /// Contact vertical position.
49 pub const MT_POSITION_Y: u16 = 0x36;
50 /// Contact identity; `-1` ends the contact in this slot.
51 pub const MT_TRACKING_ID: u16 = 0x39;
52}
53
54/// `EV_KEY` codes for buttons.
55pub mod btn {
56 /// Primary pointer button.
57 pub const LEFT: u16 = 0x110;
58 /// Secondary pointer button.
59 pub const RIGHT: u16 = 0x111;
60 /// Middle pointer button.
61 pub const MIDDLE: u16 = 0x112;
62 /// A contact is present. Single-touch panels report this instead of slots.
63 pub const TOUCH: u16 = 0x14a;
64}
65
66/// `EV_KEY` values.
67pub mod key_value {
68 /// Released.
69 pub const UP: i32 = 0;
70 /// Pressed.
71 pub const DOWN: i32 = 1;
72 /// Held long enough to auto-repeat.
73 pub const REPEAT: i32 = 2;
74}