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.
The public
Window
struct holds a mutable reference toplatform::Window
, which is a pattern that doesn't make sense for all backends. On Windows, theplatform::Window
struct itself just holds another (immutable) reference, and on macOS theplatform::Window
struct has to be wrapped in aRefCell
so that a mutable reference to it can be formed.Change the public
Window
struct to holdplatform::Window
directly, and changeplatform::Window
in the macOS and X11 backends so that it simply holds a reference to anotherWindowInner
struct similarly to the Windows backend. This allows us to remove the platform conditional in the declaration of the top-levelWindow
struct. It also allows us to remove theRefCell
wrappingplatform::Window
in the macOS backend and replace it withCell
s wrapping its individual fields.