widget: Add wait support

Widgets can now specify that they wish to wait on an fd or for a target
time to be reached.

This can be used to save a few worker threads.
This commit is contained in:
Kenny Levinsen
2019-10-05 01:07:06 +02:00
parent 510ad34183
commit 0de3da162b
10 changed files with 104 additions and 33 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
use crate::color::Color;
use crate::draw::{draw_bar, draw_box, Font, ROBOTO_REGULAR};
use crate::widget::{DrawContext, DrawReport, KeyState, ModifiersState, Widget};
use crate::widget::{DrawContext, DrawReport, KeyState, ModifiersState, Widget, WaitContext};
use std::sync::{Arc, Mutex};
@@ -61,6 +61,7 @@ impl BarWidget {
}
impl Widget for BarWidget {
fn wait(&self, _: &mut WaitContext) {}
fn enter(&mut self) {}
fn leave(&mut self) {}
fn size(&self) -> (u32, u32) {