#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers with `..Default::default()`, which a new field does not break"
)]
pub struct KeyEvent {
pub time_ms: u32,
pub key: u32,
pub pressed: bool,
pub repeat: bool,
pub sym: u32,
pub utf8: String,
}
#[derive(Debug, Clone, PartialEq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct PointerMotion {
pub time_ms: u32,
pub dx: f64,
pub dy: f64,
pub device: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct PointerButton {
pub time_ms: u32,
pub button: u32,
pub pressed: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum ScrollSource {
Wheel,
Finger,
Continuous,
}
#[derive(Debug, Clone, PartialEq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct PointerAxis {
pub time_ms: u32,
pub horizontal: f64,
pub vertical: f64,
pub source: ScrollSource,
}
#[derive(Debug, Clone, PartialEq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct PointerAbsolute {
pub time_ms: u32,
pub x: f64,
pub y: f64,
pub device: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum PointerEvent {
Motion(PointerMotion),
Absolute(PointerAbsolute),
Button(PointerButton),
Axis(PointerAxis),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum TouchPhase {
Down,
Up,
Motion,
Frame,
Cancel,
}
#[derive(Debug, Clone, PartialEq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct TouchEvent {
pub time_ms: u32,
pub slot: i32,
pub x: f64,
pub y: f64,
pub phase: TouchPhase,
pub device: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Switch {
Lid,
TabletMode,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers, with no default to fill a new field from"
)]
pub struct SwitchEvent {
pub time_ms: u32,
pub which: Switch,
pub active: bool,
}
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum InputEvent {
Key(KeyEvent),
Pointer(PointerEvent),
Touch(TouchEvent),
Switch(SwitchEvent),
}