RustAudio / baseview

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

add support for Window::Focused/Unfocused events on macOS #171

Closed httnn closed 8 months ago

httnn commented 8 months ago

trigger WindowEvent::Focused and WindowEvent::Unfocused events when the plugin window gains/loses focus. implemented by adding observers to NSNotificationCenter::defaultCenter() that listen to NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification notifications on the NSViews' window.

tested and confirmed to work in Live, Bitwig, FL Studio, Reaper and AudioPluginHost.

httnn commented 8 months ago

there was a slight oversight where the focus events were not sent correctly if the window contained other things besides just the NSView that houses the plugin. should be fixed now though, also added some comments for clarity.