RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
266 stars 57 forks source link

macOS: support events #51

Closed greatest-ape closed 3 years ago

greatest-ape commented 3 years ago

I thought it would make sense to add an issue for macOS event support, so that there is a location for a structured discussion of how to implement it. There is an analogous implementation in antonok's vst_window crate, which could be used as an inspiration.

In my understanding, the NsView created in Window::open needs to be subclassed with an event handling delegate, which stores a pointer to the WindowHandler trait implementation (?) so that its methods call be called in the event handling delegate's extern "C"-declared methods. Such an implementation would differ from the one in _vstwindow in that it would handle events synchronously instead of sending them over a channel that is polled over elsewhere.