From f9dbabce56ec12f36e92c7be4e65a55b6d865bdf Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Tue, 17 Apr 2018 19:17:11 +0200 Subject: [PATCH] backend.graphics: port no-feature code to wayland-rs 0.20 --- src/backend/graphics/egl/wayland.rs | 24 ++++++++++++------------ src/backend/mod.rs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/backend/graphics/egl/wayland.rs b/src/backend/graphics/egl/wayland.rs index 5ae241f..9b9360f 100644 --- a/src/backend/graphics/egl/wayland.rs +++ b/src/backend/graphics/egl/wayland.rs @@ -17,7 +17,7 @@ use nix::libc::c_uint; use std::fmt; use std::rc::{Rc, Weak}; use wayland_server::{Display, Resource}; -use wayland_server::protocol::wl_buffer::WlBuffer; +use wayland_server::protocol::wl_buffer::{self, WlBuffer}; use wayland_sys::server::wl_display; /// Error that can occur when accessing an EGL buffer @@ -25,7 +25,7 @@ pub enum BufferAccessError { /// The corresponding Context is not alive anymore ContextLost, /// This buffer is not managed by the EGL buffer - NotManaged(WlBuffer), + NotManaged(Resource), /// Failed to create EGLImages from the buffer EGLImageCreationFailed, /// The required EGL extension is not supported by the underlying EGL implementation @@ -175,7 +175,7 @@ pub struct EGLImages { /// Format of these images pub format: Format, images: Vec, - buffer: WlBuffer, + buffer: Resource, } impl EGLImages { @@ -225,7 +225,7 @@ impl Drop for EGLImages { } } } - self.buffer.release(); + self.buffer.send(wl_buffer::Event::Release); } } @@ -266,14 +266,14 @@ impl EGLDisplay { /// a `BufferAccessError::NotManaged(WlBuffer)` is returned with the original buffer /// to render it another way. pub fn egl_buffer_contents( - &self, buffer: WlBuffer + &self, buffer: Resource ) -> ::std::result::Result { if let Some(display) = self.0.upgrade() { let mut format: i32 = 0; if unsafe { ffi::egl::QueryWaylandBufferWL( *display, - buffer.ptr() as *mut _, + buffer.c_ptr() as *mut _, ffi::egl::EGL_TEXTURE_FORMAT, &mut format as *mut _, ) == 0 @@ -294,7 +294,7 @@ impl EGLDisplay { if unsafe { ffi::egl::QueryWaylandBufferWL( *display, - buffer.ptr() as *mut _, + buffer.c_ptr() as *mut _, ffi::egl::WIDTH as i32, &mut width as *mut _, ) == 0 @@ -306,7 +306,7 @@ impl EGLDisplay { if unsafe { ffi::egl::QueryWaylandBufferWL( *display, - buffer.ptr() as *mut _, + buffer.c_ptr() as *mut _, ffi::egl::HEIGHT as i32, &mut height as *mut _, ) == 0 @@ -318,7 +318,7 @@ impl EGLDisplay { if unsafe { ffi::egl::QueryWaylandBufferWL( *display, - buffer.ptr() as *mut _, + buffer.c_ptr() as *mut _, ffi::egl::WAYLAND_Y_INVERTED_WL, &mut inverted as *mut _, ) != 0 @@ -339,7 +339,7 @@ impl EGLDisplay { *display, ffi::egl::NO_CONTEXT, ffi::egl::WAYLAND_BUFFER_WL, - buffer.ptr() as *mut _, + buffer.c_ptr() as *mut _, out.as_ptr(), ) }; @@ -394,10 +394,10 @@ impl> EGLWaylandExtensions for E if !self.egl_to_texture_support { bail!(ErrorKind::EglExtensionNotSupported(&["GL_OES_EGL_image"])); } - let res = unsafe { ffi::egl::BindWaylandDisplayWL(*self.display, display.ptr() as *mut _) }; + let res = unsafe { ffi::egl::BindWaylandDisplayWL(*self.display, display.c_ptr() as *mut _) }; if res == 0 { bail!(ErrorKind::OtherEGLDisplayAlreadyBound); } - Ok(EGLDisplay::new(self, unsafe { display.ptr() })) + Ok(EGLDisplay::new(self, display.c_ptr())) } } diff --git a/src/backend/mod.rs b/src/backend/mod.rs index a0d970e..bb2b5c6 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -15,7 +15,7 @@ //! - libinput pub mod input; -//pub mod graphics; +pub mod graphics; //#[cfg(feature = "backend_winit")] //pub mod winit;