And here’s the fix!

This commit is contained in:
Gergely Polonkai 2022-05-21 11:37:36 +02:00
parent acf30d1001
commit b63ab3a2ef
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -60,12 +60,15 @@ fn main() {
let timer_handle = source.handle();
timer_handle.add_timeout(std::time::Duration::from_secs(1), "");
handle.insert_source(source, |_, timer_handle, _| {
println!("Redraw!");
redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw");
window.refresh();
handle.insert_source(source, |_, timer_handle, event| {
println!("Elapsed!");
timer_handle.add_timeout(std::time::Duration::from_secs(1), "");
});
if event.is_none() {
*event = Some(sctk::window::Event::Refresh);
} else {
println!("not none");
}
}).unwrap();
sctk::WaylandSource::new(queue).quick_insert(handle).unwrap();
@ -74,6 +77,7 @@ fn main() {
match next_action.take() {
Some(WEvent::Close) => break,
Some(WEvent::Refresh) => {
println!("Refresh!");
window.refresh();
window.surface().commit();
}