event loop: Decouple event timeout from event type

This commit is contained in:
Dorota Czaplejewicz
2022-11-28 14:21:30 +00:00
parent 9c9f371f91
commit 23d6beee8e
2 changed files with 19 additions and 5 deletions

View File

@ -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)