rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.88k stars 911 forks source link

Return error on missing event instead of panicking. #3944

Closed shanecelis closed 1 month ago

shanecelis commented 1 month ago

Problem: winit would panic when appkit::drag_window() was called without a left click event being present. This problem was discovered while reviewing this PR for bevy.

Solution: Return a result from drag_window(). In winit 0.30.5 drag_window() already returned a result, but 'main' branch had no return value. So this reverts the function signature to an earlier one.

It seems like this affects macOS. I exercised this on an M2 macOS machine using the "window" example.

kchibisov commented 1 month ago

Needs a changelog entry.

shanecelis commented 1 month ago

I added a change log entry under the changed and fixed section. I don't believe the other three unchecked items are necessary for this PR.