Implement reactive-rendering for text_input
... and fix the redraw queue logic in `iced_winit`.
This commit is contained in:
parent
3ba7c71e3f
commit
52490397d6
4 changed files with 201 additions and 88 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::core::mouse;
|
||||
use crate::core::time::Instant;
|
||||
use crate::core::window::Id;
|
||||
use crate::core::{Point, Size};
|
||||
use crate::graphics::Compositor;
|
||||
|
|
@ -62,6 +63,7 @@ where
|
|||
surface,
|
||||
renderer,
|
||||
mouse_interaction: mouse::Interaction::None,
|
||||
redraw_at: None,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -74,6 +76,19 @@ where
|
|||
self.entries.is_empty()
|
||||
}
|
||||
|
||||
pub fn is_idle(&self) -> bool {
|
||||
self.entries
|
||||
.values()
|
||||
.any(|window| window.redraw_at.is_some())
|
||||
}
|
||||
|
||||
pub fn redraw_at(&self) -> Option<Instant> {
|
||||
self.entries
|
||||
.values()
|
||||
.filter_map(|window| window.redraw_at)
|
||||
.min()
|
||||
}
|
||||
|
||||
pub fn first(&self) -> Option<&Window<P, C>> {
|
||||
self.entries.first_key_value().map(|(_id, window)| window)
|
||||
}
|
||||
|
|
@ -138,6 +153,7 @@ where
|
|||
pub mouse_interaction: mouse::Interaction,
|
||||
pub surface: C::Surface,
|
||||
pub renderer: P::Renderer,
|
||||
pub redraw_at: Option<Instant>,
|
||||
}
|
||||
|
||||
impl<P, C> Window<P, C>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue