event loop: Decouple event timeout from event type
This commit is contained in:
10
src/state.rs
10
src/state.rs
@ -7,6 +7,7 @@
|
||||
|
||||
use crate::animation;
|
||||
use crate::debug;
|
||||
use crate::event_loop;
|
||||
use crate::imservice::{ ContentHint, ContentPurpose };
|
||||
use crate::layout::ArrangementKind;
|
||||
use crate::main;
|
||||
@ -80,6 +81,15 @@ pub enum Event {
|
||||
TimeoutReached(Instant),
|
||||
}
|
||||
|
||||
impl event_loop::Event for Event {
|
||||
fn get_timeout_reached(&self) -> Option<Instant> {
|
||||
match self {
|
||||
Self::TimeoutReached(when) => Some(*when),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<InputMethod> for Event {
|
||||
fn from(im: InputMethod) -> Self {
|
||||
Self::InputMethod(im)
|
||||
|
||||
Reference in New Issue
Block a user