diff --git a/src/window.rs b/src/window.rs index 091a594..a0d91f6 100644 --- a/src/window.rs +++ b/src/window.rs @@ -18,6 +18,12 @@ pub struct WindowHandle { phantom: PhantomData<*mut ()>, } +/// Quick wrapper to satisfy [HasRawWindowHandle], because of course a raw window handle wouldn't +/// have a raw window handle, that would be silly. +pub(crate) struct RawWindowHandleWrapper { + pub handle: RawWindowHandle, +} + impl WindowHandle { fn new(window_handle: platform::WindowHandle) -> Self { Self { window_handle, phantom: PhantomData::default() } @@ -105,3 +111,9 @@ unsafe impl<'a> HasRawWindowHandle for Window<'a> { self.window.raw_window_handle() } } + +unsafe impl HasRawWindowHandle for RawWindowHandleWrapper { + fn raw_window_handle(&self) -> RawWindowHandle { + self.handle + } +} diff --git a/src/x11/window.rs b/src/x11/window.rs index ab56435..c1a81ac 100644 --- a/src/x11/window.rs +++ b/src/x11/window.rs @@ -11,6 +11,7 @@ use xcb::ffi::xcb_screen_t; use xcb::StructPtr; use super::XcbConnection; +use crate::window::RawWindowHandleWrapper; use crate::{ Event, MouseButton, MouseCursor, MouseEvent, PhyPoint, PhySize, ScrollDelta, WindowEvent, WindowHandler, WindowInfo, WindowOpenOptions, WindowScalePolicy, @@ -109,12 +110,6 @@ pub struct Window { // Hack to allow sending a RawWindowHandle between threads. Do not make public struct SendableRwh(RawWindowHandle); -/// Quick wrapper to satisfy [HasRawWindowHandle], because of course a raw window handle wouldn't -/// have a raw window handle, that would be silly. -struct RawWindowHandleWrapper { - handle: RawWindowHandle, -} - unsafe impl Send for SendableRwh {} type WindowOpenResult = Result; @@ -667,12 +662,6 @@ unsafe impl HasRawWindowHandle for Window { } } -unsafe impl HasRawWindowHandle for RawWindowHandleWrapper { - fn raw_window_handle(&self) -> RawWindowHandle { - self.handle - } -} - fn mouse_id(id: u8) -> MouseButton { match id { 1 => MouseButton::Left,