Added redraw request handling to widget events.

This commit is contained in:
Bingus 2023-09-28 09:48:38 -07:00 committed by Héctor Ramón Jiménez
parent 91fca024b6
commit 65f4ff060a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 8 additions and 4 deletions

View file

@ -5,10 +5,7 @@ use crate::core::mouse::{Cursor, Interaction};
use crate::core::renderer::Style;
use crate::core::widget::tree::{State, Tag};
use crate::core::widget::{tree, Tree};
use crate::core::{
self, layout, mouse, widget, Clipboard, Element, Layout, Length, Rectangle,
Shell, Size, Widget,
};
use crate::core::{self, layout, mouse, widget, Clipboard, Element, Layout, Length, Rectangle, Shell, Size, Widget, window};
use std::marker::PhantomData;
mod event;
@ -109,6 +106,9 @@ where
Some(Event::Keyboard(keyboard_event))
}
core::Event::Touch(touch_event) => Some(Event::Touch(touch_event)),
core::Event::Window(window::Event::RedrawRequested(instant)) => {
Some(Event::RedrawRequested(instant))
}
_ => None,
};

View file

@ -1,4 +1,5 @@
//! Handle events of a custom shader widget.
use std::time::Instant;
use crate::core::keyboard;
use crate::core::mouse;
use crate::core::touch;
@ -18,4 +19,7 @@ pub enum Event {
/// A keyboard event.
Keyboard(keyboard::Event),
/// A window requested a redraw.
RedrawRequested(Instant),
}