RustAudio / baseview

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

Unify Window struct across backends #162

Closed glowcoil closed 9 months ago

glowcoil commented 9 months ago

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.