feat: Add an owned display handle type
This was supposed to be rolled out with the rwh v0.6 update, but it was left behind for some reason. I've added this type back. Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
parent
73910d20cc
commit
6df972d108
15 changed files with 277 additions and 7 deletions
|
|
@ -12,8 +12,8 @@ pub(crate) mod runner;
|
|||
mod state;
|
||||
mod window_target;
|
||||
|
||||
pub use proxy::EventLoopProxy;
|
||||
pub use window_target::EventLoopWindowTarget;
|
||||
pub(crate) use proxy::EventLoopProxy;
|
||||
pub(crate) use window_target::{EventLoopWindowTarget, OwnedDisplayHandle};
|
||||
|
||||
pub struct EventLoop<T: 'static> {
|
||||
elw: RootEventLoopWindowTarget,
|
||||
|
|
|
|||
|
|
@ -704,4 +704,27 @@ impl EventLoopWindowTarget {
|
|||
pub(crate) fn waker(&self) -> Waker<Weak<Execution>> {
|
||||
self.runner.waker()
|
||||
}
|
||||
|
||||
pub(crate) fn owned_display_handle(&self) -> OwnedDisplayHandle {
|
||||
OwnedDisplayHandle
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct OwnedDisplayHandle;
|
||||
|
||||
impl OwnedDisplayHandle {
|
||||
#[cfg(feature = "rwh_05")]
|
||||
#[inline]
|
||||
pub fn raw_display_handle_rwh_05(&self) -> rwh_05::RawDisplayHandle {
|
||||
rwh_05::WebDisplayHandle::empty().into()
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::WebDisplayHandle::new().into())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue