The X11 backend has a full implementation of a `Window::set_mouse_cursor` method, but it isn't exposed via any public interface, which results in a lot of warnings for unused code. Add a public `set_mouse_cursor` method, along with stubbed-out versions in the Windows and macOS backends.
Forming mutable references to the WindowState is unsound given the possibility
of reentrant calls to NSView methods. Instead, form only immutable references
to the WindowState and wrap mutable fields in Cell and RefCell.
Follow-up work should use try_borrow_mut instead of borrow_mut to avoid
panicking in the case of reentrant calls.
RawWindowHandleWrapper is only necessary since GlContext::create takes an `impl
HasRawWindowHandle` argument, but GlContext::create is an internal unsafe API
and it is can just take a RawWindowHandle directly.
The open_as_if_parented method was intended to support the use case of Audio
Unit plugin views. However, the Audio Unit API differs in important ways from
other plugin APIs (such as VST 3 and CLAP) with regard to the lifetime
management of the plugin's NSView, and trying to support both lifetime
management patterns simultaneously has been the source of complexity and bugs.
Thus, rather than implementing Audio Unit NSView management directly in
Baseview, it will be the responsibility of plugin frameworks to implement a
compatibility layer between the Audio Unit API and the Baseview API.
We were leaking the DropTarget, so WindowState holds a reference to DropTarget again, so it can be dropped when the window is destroyed. Also, DropTarget now holds a Weak reference to WindowState and that's taken into account in callbacks.
- WindowState no longer holds a reference to DropTarget
- DropTarget is passed to RegisterDragDrop() with Rc::into_raw() instead of Rc::as_ptr() so it keeps the reference
- WindowState is created with Rc instead of Box so DropTarget can hold a Rc to it
Instead of working around the winapi bug by manually parsing the pointer we're (incorrectly) given, use the correct function signature and transmute the function pointer