Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/angle/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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<i32>,
) -> 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(
Expand Down
17 changes: 0 additions & 17 deletions src/base/io_surface/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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<i32>,
) -> 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(
Expand Down
11 changes: 0 additions & 11 deletions src/cgl/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<i32>,
) -> 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(
Expand Down
9 changes: 0 additions & 9 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<Self, Error>;

/// Creates a native widget from a raw pointer
unsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> Self::NativeWidget;

/// Create a native widget type from the given `WindowHandle`.
fn create_native_widget_from_window_handle(
&self,
Expand Down
31 changes: 0 additions & 31 deletions src/hardware_buffer/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<i32>,
) -> 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(
Expand Down
9 changes: 0 additions & 9 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
) -> Self::NativeWidget {
Connection::create_native_widget_from_ptr(self, raw, size)
}

#[inline]
fn create_native_widget_from_window_handle(
&self,
Expand Down
9 changes: 0 additions & 9 deletions src/mesa_surfaceless/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
) -> NativeWidget {
NativeWidget
}

/// Create a native widget type from the given `WindowHandle`.
#[inline]
pub fn create_native_widget_from_window_handle(
Expand Down
27 changes: 0 additions & 27 deletions src/multi/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Def, Alt>
where
Expand Down Expand Up @@ -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<i32>,
) -> NativeWidget<Def, Alt> {
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,
Expand Down Expand Up @@ -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<i32>,
) -> NativeWidget<Def, Alt> {
Connection::create_native_widget_from_ptr(self, raw, size)
}

fn create_native_widget_from_window_handle(
&self,
handle: raw_window_handle::WindowHandle,
Expand Down
12 changes: 0 additions & 12 deletions src/wayland/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
) -> 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,
Expand Down
13 changes: 0 additions & 13 deletions src/wgl/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<i32>,
) -> 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,
Expand Down
11 changes: 0 additions & 11 deletions src/x11/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
) -> 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,
Expand Down
Loading