outputs: Notify the state manager about changes

This commit is contained in:
Dorota Czaplejewicz
2022-01-23 18:57:27 +00:00
parent 14a485deba
commit d3eb68ed5a
2 changed files with 59 additions and 12 deletions

View File

@ -8,6 +8,7 @@
use crate::animation;
use crate::imservice::{ ContentHint, ContentPurpose };
use crate::main::{ Commands, PanelCommand };
use crate::outputs;
use std::time::Instant;
@ -36,7 +37,7 @@ pub enum Event {
InputMethod(InputMethod),
Visibility(visibility::Event),
PhysicalKeyboard(Presence),
Output(outputs::Event),
/// Event triggered because a moment in time passed.
/// Use to animate state transitions.
/// The value is the ideal arrival time.
@ -49,6 +50,12 @@ impl From<InputMethod> for Event {
}
}
impl From<outputs::Event> for Event {
fn from(ev: outputs::Event) -> Self {
Self::Output(ev)
}
}
pub mod visibility {
#[derive(Clone)]
pub enum Event {
@ -166,6 +173,11 @@ impl Application {
..self
},
Event::Output(output) => {
println!("Stub: output event {:?}", output);
self
},
Event::InputMethod(new_im) => match (self.im.clone(), new_im) {
(InputMethod::Active(_old), InputMethod::Active(new_im))
=> Self {