summaryrefslogtreecommitdiffstats
path: root/examples
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 /examples
parentc0a5dc980eed9d6df5a259c861cfc5c1a0cfdcca (diff)
downloadiced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.tar.gz
iced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.tar.bz2
iced-49dbf2c14658cb5f2aafdbb75d826d8ba8fedc31.zip
Request a redraw only on relevant events
Diffstat (limited to 'examples')
-rw-r--r--examples/integration/src/main.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index db8b4366..4c4b6d84 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -119,16 +119,19 @@ pub fn main() {
}
}
Event::MainEventsCleared => {
- // We update iced
- let _ = state.update(
- None,
- viewport.logical_size(),
- &mut renderer,
- &mut debug,
- );
+ // If there are events pending
+ if !state.is_queue_empty() {
+ // We update iced
+ let _ = state.update(
+ None,
+ viewport.logical_size(),
+ &mut renderer,
+ &mut debug,
+ );
- // and request a redraw
- window.request_redraw();
+ // and request a redraw
+ window.request_redraw();
+ }
}
Event::RedrawRequested(_) => {
if resized {