pub struct WlEglSurface { /* private fields */ }
Expand description

EGL surface

This object is a simple wrapper around a wl_surface to add the EGL capabilities. Just use the ptr() method once this object is created to get the window pointer your OpenGL library is needing to initialize the EGL context (you’ll most likely need the display ptr as well, that you can get via the ObjectId::as_ptr() method on of the wl_display ID).

Implementations§

source§

impl WlEglSurface

source

pub fn new(surface: ObjectId, width: i32, height: i32) -> Result<Self, Error>

Create an EGL surface from a wayland surface

This method will check that the provided ObjectId is still alive and from the correct interface (wl_surface).

You must always destroy the WlEglSurface before the underling wl_surface protocol object.

source

pub unsafe fn new_from_raw( surface: *mut wl_proxy, width: i32, height: i32 ) -> Result<Self, Error>

Create an EGL surface from a raw pointer to a wayland surface.

Safety

The provided pointer must be a valid wl_surface pointer from libwayland-client.

source

pub fn get_size(&self) -> (i32, i32)

Fetch current size of the EGL surface

source

pub fn resize(&self, width: i32, height: i32, dx: i32, dy: i32)

Resize the EGL surface

The two first arguments (width, height) are the new size of the surface, the two others (dx, dy) represent the displacement of the top-left corner of the surface. It allows you to control the direction of the resizing if necessary.

source

pub fn ptr(&self) -> *const c_void

Raw pointer to the EGL surface

You’ll need this pointer to initialize the EGL context in your favourite OpenGL lib.

Trait Implementations§

source§

impl Debug for WlEglSurface

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for WlEglSurface

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for WlEglSurface

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.