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

Unify Window struct across backends #162

Merged
merged 4 commits into from
Dec 17, 2023

Conversation

glowcoil
Copy link
Member

@glowcoil glowcoil commented Dec 17, 2023

The public Window struct holds a mutable reference to platform::Window, which is a pattern that doesn't make sense for all backends. On Windows, the platform::Window struct itself just holds another (immutable) reference, and on macOS the platform::Window struct has to be wrapped in a RefCell so that a mutable reference to it can be formed.

Change the public Window struct to hold platform::Window directly, and change platform::Window in the macOS and X11 backends so that it simply holds a reference to another WindowInner struct similarly to the Windows backend. This allows us to remove the platform conditional in the declaration of the top-level Window struct. It also allows us to remove the RefCell wrapping platform::Window in the macOS backend and replace it with Cells wrapping its individual fields.

@glowcoil glowcoil merged commit fdb43ea into RustAudio:master Dec 17, 2023
3 checks passed
@glowcoil glowcoil deleted the window-refactor branch December 17, 2023 08:21
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