diff --git a/src/event_loop.rs b/src/event_loop.rs index f992750468..68b6470001 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -400,6 +400,14 @@ unsafe impl HasRawDisplayHandle for EventLoopWindowTarget { } } +impl HasDisplayHandle for EventLoopWindowTarget { + fn display_handle(&self) -> Result, HandleError> { + // SAFETY: The returned display handle is always valid for this lifetime. + self.raw_display_handle() + .map(|handle| unsafe { DisplayHandle::borrow_raw(handle) }) + } +} + unsafe impl raw_window_handle_05::HasRawDisplayHandle for EventLoopWindowTarget { fn raw_display_handle(&self) -> raw_window_handle_05::RawDisplayHandle { let result = HasRawDisplayHandle::raw_display_handle(self);