mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 13:20:06 -04:00
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:
@@ -584,11 +584,34 @@ impl EventLoopWindowTarget {
|
||||
self.runner_shared.clear_exit();
|
||||
}
|
||||
|
||||
pub(crate) fn owned_display_handle(&self) -> OwnedDisplayHandle {
|
||||
OwnedDisplayHandle
|
||||
}
|
||||
|
||||
fn exit_code(&self) -> Option<i32> {
|
||||
self.runner_shared.exit_code()
|
||||
}
|
||||
}
|
||||
|
||||
#[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::WindowsDisplayHandle::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::WindowsDisplayHandle::new().into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the id of the main thread.
|
||||
///
|
||||
/// Windows has no real API to check if the current executing thread is the "main thread", unlike
|
||||
|
||||
@@ -8,7 +8,8 @@ use windows_sys::Win32::{
|
||||
|
||||
pub(crate) use self::{
|
||||
event_loop::{
|
||||
EventLoop, EventLoopProxy, EventLoopWindowTarget, PlatformSpecificEventLoopAttributes,
|
||||
EventLoop, EventLoopProxy, EventLoopWindowTarget, OwnedDisplayHandle,
|
||||
PlatformSpecificEventLoopAttributes,
|
||||
},
|
||||
icon::{SelectedCursor, WinIcon},
|
||||
keyboard::{physicalkey_to_scancode, scancode_to_physicalkey},
|
||||
|
||||
Reference in New Issue
Block a user