Mads Marquart
Mads Marquart
macOS and iOS have the pervasive concept of "main thread safety", which essentially just means that every UI operation has to happen on the main thread. We have some support...
This was introduced in https://github.com/rust-windowing/winit/pull/609 (CC @mtak-), and while it makes sense, it feels quite unclean and inhibits other improvements (also, it is unsound, but that could be fixed by...
Reported in discussions: https://github.com/rust-windowing/winit/discussions/1949#discussioncomment-788365
Of particular note: - `libc` is not needed in most cases, one can simply use `std::os::raw` - `leaky-cow` seems like it existed to work around compiler limitations, these are no...
Replace `objc` with my fork, [`objc2`](https://github.com/madsmtm/objc2). This crate contains many improvements, in particular: - Better tools for protecting against UB (see first commit) - You no longer have to worry...
Helps with following Cocoa's memory management rules (for example, https://github.com/rust-windowing/glutin/pull/1453 wouldn't have happened with this) - and while I was at it, I fixed a few C `enum` definitions (`objc2`'s...
This is very similar to [using `bindgen`](https://github.com/madsmtm/objc2/issues/85), but I went with creating things from scratch because: 1. `bindgen` is kinda intimidating, knowing so little about `libclang`, so I started here...
See [Passing to an out parameter by writeback](https://clang.llvm.org/docs/AutomaticReferenceCounting.html#passing-to-an-out-parameter-by-writeback). Some methods take pointers to an instance, and, if the pointer is not NULL, write some value to the pointer. Examples include:...
## Background Many methods take an `NSError**` as their last parameter, which is used to communicate errors to the caller, see [Error Handling Programming Guide For Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/ErrorHandling/ErrorHandling.html). Swift [has a...