rust-windowing / rust-windowing/winit
WaitCancelled on macOS without other events
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
I was playing with nannou today and I noticed that their LoopMode::Wait is not working on macOS. This is intended to prevent rerenders unless an input or window event is received. It achieves this by using winit's ControlFlow::Wait under the hood. This works fine on Windows, but on macOS, the wait is interrupted (at 60fps), even though there are (as far as I can tell) no events requiring that the wait be interrupted.
I ran winit/examples/window.rs on my Macbook Pro and saw many instances of the following event sequence:
...
NewEvents(WaitCancelled { start: Instant { t: 1014694701148459 }, requested_resume: None })
MainEventsCleared
RedrawRequested(WindowId(Id(140590972026416)))
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 1014694701163499 }, requested_resume: None })
MainEventsCleared
RedrawRequested(WindowId(Id(140590972026416)))
RedrawEventsCleared
...
I have a couple questions regarding this behavior:
- Is it expected that one would receive
NewEventswhen there don't seem to be any such events? - Does the
winitAPI guarantee that your wait won't be interrupted if there are no new events?
If the answer to (2) is "no", it seems like the nannou LoopMode::Wait implementation will need to change, regardless of whether this is unexpected / buggy behavior.
Related issue in nannou: https://github.com/nannou-org/nannou/issues/781
Thanks! Let me know if I can help with anything.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run winit/examples/window.rs on macOS and inspect the reported NewEvents(WaitCancelled) sequence around MainEventsCleared and RedrawRequested. Compare the observed behavior with ControlFlow::Wait and the related nannou issue; document whether the interruption is expected and whether the API guarantees an uninterrupted wait.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100