And here’s the fix!
This commit is contained in:
parent
acf30d1001
commit
b63ab3a2ef
14
src/main.rs
14
src/main.rs
@ -60,12 +60,15 @@ fn main() {
|
|||||||
let timer_handle = source.handle();
|
let timer_handle = source.handle();
|
||||||
timer_handle.add_timeout(std::time::Duration::from_secs(1), "");
|
timer_handle.add_timeout(std::time::Duration::from_secs(1), "");
|
||||||
|
|
||||||
handle.insert_source(source, |_, timer_handle, _| {
|
handle.insert_source(source, |_, timer_handle, event| {
|
||||||
println!("Redraw!");
|
println!("Elapsed!");
|
||||||
redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw");
|
|
||||||
window.refresh();
|
|
||||||
timer_handle.add_timeout(std::time::Duration::from_secs(1), "");
|
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();
|
sctk::WaylandSource::new(queue).quick_insert(handle).unwrap();
|
||||||
|
|
||||||
@ -74,6 +77,7 @@ fn main() {
|
|||||||
match next_action.take() {
|
match next_action.take() {
|
||||||
Some(WEvent::Close) => break,
|
Some(WEvent::Close) => break,
|
||||||
Some(WEvent::Refresh) => {
|
Some(WEvent::Refresh) => {
|
||||||
|
println!("Refresh!");
|
||||||
window.refresh();
|
window.refresh();
|
||||||
window.surface().commit();
|
window.surface().commit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user