Closed dtzxporter closed 4 months ago
Will rework this once #2191 lands.
How does one get from a iced::widget::shader::wgpu::rwh::WindowHandle
to something like a wayland_client::protocol::wl_registry::WlRegistry
or even a wayland_client::protocol::wl_shell_surface::WlShellSurface
?
What about global protocol objects like wl_output
?
You call as_raw
, then pattern match on Wayland
, and you keep going from there.
https://docs.rs/iced/latest/iced/widget/shader/wgpu/rwh/enum.RawWindowHandle.html#variant.Wayland
I looked at that before asking here, but that variant's associated type is:
pub struct WaylandWindowHandle {
pub surface: NonNull<c_void>,
}
I'm not sure how to operate on a c_void
(which is basically a type-erased pointer). Can't this actually be a reference with a proper type instead?
This should alleviate some of the concerns in: https://github.com/iced-rs/iced/pull/2194#issuecomment-1888517346 because it will force the callback to be ran in the event loop in iced, and gives us a reference to the window directly instead. While the user could mess up the iced state by making changes here, I think that anyone using this method should know what they are doing and it's an advanced use case.
Links:
2194