Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Mar 25, 2024

Conversation

httnn
Copy link
Contributor

@httnn httnn commented Mar 19, 2024

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
Copy link
Contributor Author

httnn commented Mar 21, 2024

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.

src/macos/window.rs Outdated Show resolved Hide resolved
src/macos/window.rs Outdated Show resolved Hide resolved
src/macos/window.rs Outdated Show resolved Hide resolved
Copy link
Contributor Author

@httnn httnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review @glowcoil! making NSView the observer seemed to address all your comments. just a few questions here still.

src/macos/view.rs Outdated Show resolved Hide resolved
src/macos/view.rs Outdated Show resolved Hide resolved
src/macos/view.rs Outdated Show resolved Hide resolved
@glowcoil glowcoil merged commit 085ae2a into RustAudio:master Mar 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants