summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-09 15:45:57 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-09 15:45:57 +0200
commit49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31 (patch)
tree4db37fc957de953650c2bad86f648312936a1813 /native
parentc0a5dc980eed9d6df5a259c861cfc5c1a0cfdcca (diff)
downloadiced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.tar.gz
iced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.tar.bz2
iced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.zip
Request a redraw only on relevant events
Diffstat (limited to 'native')
-rw-r--r--native/src/program/state.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/native/src/program/state.rs b/native/src/program/state.rs
index 8716d8b9..bb428198 100644
--- a/native/src/program/state.rs
+++ b/native/src/program/state.rs
@@ -88,6 +88,13 @@ where
self.queued_messages.push(message);
}
+ /// Returns whether the event queue of the [`State`] is empty or not.
+ ///
+ /// [`State`]: struct.State.html
+ pub fn is_queue_empty(&self) -> bool {
+ self.queued_events.is_empty() && self.queued_messages.is_empty()
+ }
+
/// Processes all the queued events and messages, rebuilding and redrawing
/// the widgets of the linked [`Program`] if necessary.
///
@@ -102,10 +109,6 @@ where
renderer: &mut P::Renderer,
debug: &mut Debug,
) -> Option<Command<P::Message>> {
- if self.queued_events.is_empty() && self.queued_messages.is_empty() {
- return None;
- }
-
let mut user_interface = build_user_interface(
&mut self.program,
self.cache.take().unwrap(),