surfman::platform::unix::default::connection

Type Alias Connection

Source
pub type Connection = Connection<Device<Device, Device>, Device>;
Expand description

Either a Wayland or an X11 display server connection.

Aliased Type§

enum Connection {
    Default(Connection<Device, Device>),
    Alternate(Connection),
}

Variants§

§

Default(Connection<Device, Device>)

The default connection to the display server.

§

Alternate(Connection)

The alternate connection to the display server.

Implementations

Source§

impl<Def, Alt> Connection<Def, Alt>
where Def: DeviceInterface, Alt: DeviceInterface, Def::Connection: ConnectionInterface<Device = Def>, Alt::Connection: ConnectionInterface<Device = Alt>,

Source

pub fn new() -> Result<Connection<Def, Alt>, Error>

Connects to the default display.

Source

pub fn native_connection(&self) -> NativeConnection<Def, Alt>

Returns the native connection corresponding to this connection.

Source

pub fn gl_api(&self) -> GLApi

Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).

Source

pub fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system.

This is an alias for Connection::create_hardware_adapter().

Source

pub fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters.

Source

pub fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring low-power hardware adapters.

Source

pub fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring software adapters.

Source

pub fn create_device( &self, adapter: &Adapter<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>

Opens the hardware device corresponding to the given adapter.

Device handles are local to a single thread.

Source

pub unsafe fn create_device_from_native_device( &self, native_device: NativeDevice<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>

Wraps a native device in a device.

Source

pub fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>

Opens the display connection corresponding to the given DisplayHandle.

Source

pub unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> NativeWidget<Def, Alt>

Create a native widget from a raw pointer

Source

pub fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<NativeWidget<Def, Alt>, Error>

Create a native widget type from the given WindowHandle.

Trait Implementations

Source§

impl<Def, Alt> Clone for Connection<Def, Alt>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Def, Alt> Connection for Connection<Def, Alt>
where Def: DeviceInterface, Alt: DeviceInterface, Def::Connection: ConnectionInterface<Device = Def>, Alt::Connection: ConnectionInterface<Device = Alt>,

Source§

type Adapter = Adapter<Def, Alt>

The adapter type associated with this connection.
Source§

type Device = Device<Def, Alt>

The device type associated with this connection.
Source§

type NativeConnection = NativeConnection<Def, Alt>

The native type associated with this connection.
Source§

type NativeDevice = NativeDevice<Def, Alt>

The native device type associated with this connection.
Source§

type NativeWidget = NativeWidget<Def, Alt>

The native widget type associated with this connection.
Source§

fn new() -> Result<Connection<Def, Alt>, Error>

Connects to the default display.
Source§

fn native_connection(&self) -> NativeConnection<Def, Alt>

Returns the native connection corresponding to this connection.
Source§

fn gl_api(&self) -> GLApi

Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).
Source§

fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters. Read more
Source§

fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters.
Source§

fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring low-power hardware adapters.
Source§

fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>

Returns the “best” adapter on this system, preferring software adapters.
Source§

fn create_device( &self, adapter: &Adapter<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>

Opens a device.
Source§

unsafe fn create_device_from_native_device( &self, native_device: NativeDevice<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>

Wraps an existing native device type in a device.
Source§

fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>

Opens the display connection corresponding to the given DisplayHandle.
Source§

unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> NativeWidget<Def, Alt>

Creates a native widget from a raw pointer
Source§

fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>

Create a native widget type from the given WindowHandle.