diff --git a/src/angle/connection.rs b/src/angle/connection.rs index b46a5c57..2522073d 100644 --- a/src/angle/connection.rs +++ b/src/angle/connection.rs @@ -13,8 +13,6 @@ use crate::{Adapter, AdapterPreferences, Error, GLApi, PowerPreference, Renderin use euclid::default::Size2D; -use std::os::raw::c_void; - use winapi::shared::minwindef::UINT; use winapi::um::d3dcommon::{D3D_DRIVER_TYPE_UNKNOWN, D3D_DRIVER_TYPE_WARP}; @@ -113,17 +111,6 @@ impl Connection { Connection::new() } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - NativeWidget { - egl_native_window: raw as EGLNativeWindowType, - } - } - /// Create a native widget type from the given `WindowHandle`. #[inline] pub fn create_native_widget_from_window_handle( diff --git a/src/base/io_surface/connection.rs b/src/base/io_surface/connection.rs index 92d4f36e..6750b7cc 100644 --- a/src/base/io_surface/connection.rs +++ b/src/base/io_surface/connection.rs @@ -9,7 +9,6 @@ use super::surface::NativeWidget; use crate::adapter::{AdapterPreferences, PowerPreference, RenderingPreference}; use crate::Error; -use objc2::rc::Retained; use objc2_app_kit::NSView; use objc2_core_foundation::{CFBoolean, CFBundle, CFMutableDictionary, CFRetained, CFString}; @@ -98,22 +97,6 @@ impl Connection { Connection::new() } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - let view_ptr: *mut NSView = raw.cast(); - NativeWidget { - // SAFETY: Validity of the NSView is upheld by caller. - // TODO(madsmtm): We should probably `retain` here, rather than - // take ownership of the pointer. - view: unsafe { Retained::from_raw(view_ptr).unwrap() }, - opaque: true, - } - } - /// Create a native widget type from the given `WindowHandle`. #[inline] pub fn create_native_widget_from_window_handle( diff --git a/src/cgl/connection.rs b/src/cgl/connection.rs index 2ee2fb43..652dd78c 100644 --- a/src/cgl/connection.rs +++ b/src/cgl/connection.rs @@ -13,8 +13,6 @@ use crate::GLApi; use euclid::default::Size2D; -use std::os::raw::c_void; - pub use crate::base::io_surface::connection::NativeConnection; /// A connection to the display server. @@ -80,15 +78,6 @@ impl Connection { SystemConnection::from_display_handle(handle).map(Connection) } - /// Creates a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> NativeWidget { - self.0.create_native_widget_from_ptr(raw, size) - } - /// Create a native widget type from the given `WindowHandle`. #[inline] pub fn create_native_widget_from_window_handle( diff --git a/src/connection.rs b/src/connection.rs index 940913a5..8702daf6 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -7,8 +7,6 @@ use crate::GLApi; use euclid::default::Size2D; -use std::os::raw::c_void; - /// Methods relating to display server connections. pub trait Connection: Sized { /// The device type associated with this connection. @@ -31,13 +29,6 @@ pub trait Connection: Sized { /// Opens the display connection corresponding to the given `DisplayHandle`. fn from_display_handle(handle: raw_window_handle::DisplayHandle) -> Result; - /// Creates a native widget from a raw pointer - unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> Self::NativeWidget; - /// Create a native widget type from the given `WindowHandle`. fn create_native_widget_from_window_handle( &self, diff --git a/src/hardware_buffer/connection.rs b/src/hardware_buffer/connection.rs index d95f58c7..8fffb997 100644 --- a/src/hardware_buffer/connection.rs +++ b/src/hardware_buffer/connection.rs @@ -7,15 +7,8 @@ use super::device::{Device, NativeDevice}; use super::surface::NativeWidget; use crate::{Adapter, AdapterPreferences, Error, GLApi}; -#[cfg(android_platform)] -use super::android_ffi::ANativeWindow; -#[cfg(ohos_platform)] -use super::ohos_ffi::OHNativeWindow; - use euclid::default::Size2D; -use std::os::raw::c_void; - /// A connection to the display server. #[derive(Clone)] pub struct Connection; @@ -84,30 +77,6 @@ impl Connection { Ok(Connection) } - #[cfg(android_platform)] - fn create_native_widget_from_ptr_impl(raw: *mut c_void) -> NativeWidget { - NativeWidget { - native_window: raw as *mut ANativeWindow, - } - } - - #[cfg(ohos_platform)] - fn create_native_widget_from_ptr_impl(raw: *mut c_void) -> NativeWidget { - NativeWidget { - native_window: raw as *mut OHNativeWindow, - } - } - - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - debug_assert!(!raw.is_null()); - Self::create_native_widget_from_ptr_impl(raw) - } - #[cfg(android_platform)] #[inline] fn create_native_widget_from_raw_window_handle( diff --git a/src/macros.rs b/src/macros.rs index d747120e..508b1ed3 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -82,15 +82,6 @@ macro_rules! implement_interfaces { Connection::from_display_handle(handle) } - #[inline] - unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> Self::NativeWidget { - Connection::create_native_widget_from_ptr(self, raw, size) - } - #[inline] fn create_native_widget_from_window_handle( &self, diff --git a/src/mesa_surfaceless/connection.rs b/src/mesa_surfaceless/connection.rs index 97ecdd0d..c9f29f70 100644 --- a/src/mesa_surfaceless/connection.rs +++ b/src/mesa_surfaceless/connection.rs @@ -114,15 +114,6 @@ impl Connection { Err(Error::IncompatibleNativeWidget) } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - _raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - NativeWidget - } - /// Create a native widget type from the given `WindowHandle`. #[inline] pub fn create_native_widget_from_window_handle( diff --git a/src/multi/connection.rs b/src/multi/connection.rs index c5cff495..55e6c4c3 100644 --- a/src/multi/connection.rs +++ b/src/multi/connection.rs @@ -10,8 +10,6 @@ use crate::{Adapter, Error}; use euclid::default::Size2D; -use std::os::raw::c_void; - /// A connection to the display server. pub enum Connection where @@ -93,22 +91,6 @@ where } } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> NativeWidget { - match *self { - Connection::Default(ref connection) => { - NativeWidget::Default(connection.create_native_widget_from_ptr(raw, size)) - } - Connection::Alternate(ref connection) => { - NativeWidget::Alternate(connection.create_native_widget_from_ptr(raw, size)) - } - } - } - /// Create a native widget type from the given `WindowHandle`. pub fn create_native_widget_from_window_handle( &self, @@ -162,15 +144,6 @@ where Connection::from_display_handle(handle) } - #[inline] - unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> NativeWidget { - Connection::create_native_widget_from_ptr(self, raw, size) - } - fn create_native_widget_from_window_handle( &self, handle: raw_window_handle::WindowHandle, diff --git a/src/wayland/connection.rs b/src/wayland/connection.rs index 6c304af4..95f936d9 100644 --- a/src/wayland/connection.rs +++ b/src/wayland/connection.rs @@ -157,18 +157,6 @@ impl Connection { } } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - size: Size2D, - ) -> NativeWidget { - NativeWidget { - wayland_surface: raw as *mut wl_proxy, - size, - } - } - /// Creates a native widget type from the given `WindowHandle` pub fn create_native_widget_from_window_handle( &self, diff --git a/src/wgl/connection.rs b/src/wgl/connection.rs index 00b0501d..5357f3b6 100644 --- a/src/wgl/connection.rs +++ b/src/wgl/connection.rs @@ -9,8 +9,6 @@ use crate::{Adapter, AdapterPreferences, Error, GLApi}; use euclid::default::Size2D; -use std::os::raw::c_void; - use winapi::shared::windef::HWND; /// Represents a connection to the display server. @@ -82,17 +80,6 @@ impl Connection { Connection::new() } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - NativeWidget { - window_handle: raw as HWND, - } - } - /// Create a native widget type from the given `WindowHandle`. pub fn create_native_widget_from_window_handle( &self, diff --git a/src/x11/connection.rs b/src/x11/connection.rs index b1ba4369..5829b55e 100644 --- a/src/x11/connection.rs +++ b/src/x11/connection.rs @@ -194,17 +194,6 @@ impl Connection { Connection::from_x11_display(display) } - /// Create a native widget from a raw pointer - pub unsafe fn create_native_widget_from_ptr( - &self, - raw: *mut c_void, - _size: Size2D, - ) -> NativeWidget { - NativeWidget { - window: std::mem::transmute(raw), - } - } - /// Create a native widget type from the given `WindowHandle`. pub fn create_native_widget_from_window_handle( &self,