Skip to content

Commit f7f842d

Browse files
committed
fix wayland freeze (closes #1461 #1081)
1 parent e25a878 commit f7f842d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • rio-window/src/platform_impl/linux/wayland/event_loop

rio-window/src/platform_impl/linux/wayland/event_loop/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,18 @@ impl<T: 'static> EventLoop<T> {
505505
return None;
506506
}
507507

508+
// Reset the frame-callback state so the window can accept a new
509+
// callback when the app commits (pre_present_notify).
510+
//
511+
// NOTE: don't call request_frame_callback here. It would call
512+
// wl_suface::frame() before we know wether a render will happen.
513+
// If this iteration emits no RedraRequested, the app never commits,
514+
// callback stay pending forever and the next itration sees
515+
// state == Requested and short-cirtuits above.
516+
// Freezing the loop until external events happen to work around it.
508517
let was_received =
509518
window.frame_callback_state() == FrameCallbackState::Received;
510519
window.frame_callback_reset();
511-
if was_received {
512-
window.request_frame_callback();
513-
}
514520

515521
let mut redraw_requested = window_requests
516522
.get(window_id)

0 commit comments

Comments
 (0)