Struct surfman::platform::unix::wayland::connection::Connection
source · pub struct Connection {
pub(crate) native_connection: Arc<NativeConnectionWrapper>,
}
Expand description
A connection to the Wayland server.
Fields§
§native_connection: Arc<NativeConnectionWrapper>
Implementations§
source§impl Connection
impl Connection
sourcepub fn new() -> Result<Connection, Error>
pub fn new() -> Result<Connection, Error>
Connects to the default Wayland server.
sourcepub unsafe fn from_native_connection(
native_connection: NativeConnection,
) -> Result<Connection, Error>
pub unsafe fn from_native_connection( native_connection: NativeConnection, ) -> Result<Connection, Error>
Wraps an existing EGL display in a Connection
.
The display is not retained, as there is no way to do this in the EGL API. Therefore, it is the caller’s responsibility to ensure that the EGL display remains alive as long as the connection is.
sourcepub fn native_connection(&self) -> NativeConnection
pub fn native_connection(&self) -> NativeConnection
Returns the underlying native connection.
sourcepub fn gl_api(&self) -> GLApi
pub fn gl_api(&self) -> GLApi
Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).
sourcepub fn create_adapter(&self) -> Result<Adapter, Error>
pub fn create_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
This is an alias for Connection::create_hardware_adapter()
.
sourcepub fn create_hardware_adapter(&self) -> Result<Adapter, Error>
pub fn create_hardware_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
sourcepub fn create_low_power_adapter(&self) -> Result<Adapter, Error>
pub fn create_low_power_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring low-power hardware adapters.
sourcepub fn create_software_adapter(&self) -> Result<Adapter, Error>
pub fn create_software_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring software adapters.
sourcepub fn create_device(&self, adapter: &Adapter) -> Result<Device, Error>
pub fn create_device(&self, adapter: &Adapter) -> Result<Device, Error>
Opens the hardware device corresponding to the given adapter.
Device handles are local to a single thread.
sourcepub unsafe fn create_device_from_native_device(
&self,
native_device: NativeDevice,
) -> Result<Device, Error>
pub unsafe fn create_device_from_native_device( &self, native_device: NativeDevice, ) -> Result<Device, Error>
Opens the hardware device corresponding to the adapter wrapped in the given native device.
This is present for compatibility with other backends.
unsafe fn from_wayland_display( wayland_display: *mut wl_display, is_owned: bool, ) -> Result<Connection, Error>
fn from_egl_display( egl_display: *const c_void, wayland_display: Option<*mut wl_display>, ) -> Result<Connection, Error>
sourcepub fn from_display_handle(
handle: DisplayHandle<'_>,
) -> Result<Connection, Error>
pub fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection, Error>
Opens the display connection corresponding to the given DisplayHandle
.
sourcepub unsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> NativeWidget
pub unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> NativeWidget
Create a native widget from a raw pointer
sourcepub fn create_native_widget_from_window_handle(
&self,
handle: WindowHandle<'_>,
window_size: Size2D<i32>,
) -> Result<NativeWidget, Error>
pub fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, window_size: Size2D<i32>, ) -> Result<NativeWidget, Error>
Creates a native widget type from the given WindowHandle
Trait Implementations§
source§impl Clone for Connection
impl Clone for Connection
source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Connection for Connection
impl Connection for Connection
§type NativeConnection = NativeConnection
type NativeConnection = NativeConnection
§type NativeDevice = NativeDevice
type NativeDevice = NativeDevice
§type NativeWidget = NativeWidget
type NativeWidget = NativeWidget
source§fn native_connection(&self) -> Self::NativeConnection
fn native_connection(&self) -> Self::NativeConnection
source§fn gl_api(&self) -> GLApi
fn gl_api(&self) -> GLApi
source§fn create_adapter(&self) -> Result<Self::Adapter, Error>
fn create_adapter(&self) -> Result<Self::Adapter, Error>
source§fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
source§fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
source§fn create_software_adapter(&self) -> Result<Self::Adapter, Error>
fn create_software_adapter(&self) -> Result<Self::Adapter, Error>
source§unsafe fn create_device_from_native_device(
&self,
native_device: Self::NativeDevice,
) -> Result<Device, Error>
unsafe fn create_device_from_native_device( &self, native_device: Self::NativeDevice, ) -> Result<Device, Error>
source§fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Connection, Error>
fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Connection, Error>
DisplayHandle
.source§unsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> Self::NativeWidget
unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> Self::NativeWidget
source§fn create_native_widget_from_window_handle(
&self,
window: WindowHandle<'_>,
size: Size2D<i32>,
) -> Result<Self::NativeWidget, Error>
fn create_native_widget_from_window_handle( &self, window: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>
WindowHandle
.