From 230b37df56bb0dccd5152db0f5af31d0d9facea6 Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Fri, 10 Feb 2023 16:25:22 +0100 Subject: [PATCH] Implement `HasRawDisplayHandle` for `EventLoop` (#2677) * Implement `HasRawDisplayHandle` for `EventLoop` * Add changelog entry --- CHANGELOG.md | 2 ++ src/event_loop.rs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a44a18bbab..9a94cf550d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- Implement `HasRawDisplayHandle` for `EventLoop`. + # 0.28.1 - On Wayland, fix crash when dropping a window in multi-window setup. diff --git a/src/event_loop.rs b/src/event_loop.rs index abdd47ece1..a10ba36831 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -313,6 +313,13 @@ impl EventLoop { } } +unsafe impl HasRawDisplayHandle for EventLoop { + /// Returns a [`raw_window_handle::RawDisplayHandle`] for the event loop. + fn raw_display_handle(&self) -> RawDisplayHandle { + self.event_loop.window_target().p.raw_display_handle() + } +} + impl Deref for EventLoop { type Target = EventLoopWindowTarget; fn deref(&self) -> &EventLoopWindowTarget {