diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index ddd23eec90..9e3dae1d30 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -22,7 +22,7 @@ default = ["x11", "wayland", "wayland-dlopen"] [dependencies] lazy_static = "1.3" -winit = { version = "0.26", default-features = false } +winit = { version = "0.26", default-features = false, path="../../winit" } [target.'cfg(target_os = "android")'.dependencies] android_glue = "0.2" diff --git a/glutin/src/api/android/mod.rs b/glutin/src/api/android/mod.rs index 09d1036df3..18ef90b1ba 100644 --- a/glutin/src/api/android/mod.rs +++ b/glutin/src/api/android/mod.rs @@ -4,7 +4,7 @@ use crate::api::egl::{Context as EglContext, NativeDisplay, SurfaceType as EglSu use crate::CreationError::{self, OsError}; use crate::{Api, ContextError, GlAttributes, PixelFormat, PixelFormatRequirements, Rect}; -use crate::platform::android::EventLoopExtAndroid; +use crate::platform::android::EventLoopWindowTargetExtAndroid; use glutin_egl_sys as ffi; use parking_lot::Mutex; use winit; @@ -142,6 +142,11 @@ impl Context { #[inline] pub fn resize(&self, _: u32, _: u32) {} + #[inline] + pub fn buffer_age(&self) -> u32 { + self.0.egl_context.buffer_age() + } + #[inline] pub fn is_current(&self) -> bool { self.0.egl_context.is_current() diff --git a/glutin/src/api/egl/mod.rs b/glutin/src/api/egl/mod.rs index ed14a6f868..e9635fa777 100644 --- a/glutin/src/api/egl/mod.rs +++ b/glutin/src/api/egl/mod.rs @@ -618,7 +618,7 @@ impl Context { pub fn swap_buffers_with_damage(&self, rects: &[Rect]) -> Result<(), ContextError> { let egl = EGL.as_ref().unwrap(); - if !egl.SwapBuffersWithDamageKHR.is_loaded() { + if !self.swap_buffers_with_damage_supported() { return Err(ContextError::FunctionUnavailable); } @@ -658,12 +658,18 @@ impl Context { } #[inline] - #[cfg(not(target_os = "windows"))] + #[cfg(not(any(target_os = "windows", target_os = "android")))] pub fn swap_buffers_with_damage_supported(&self) -> bool { let egl = EGL.as_ref().unwrap(); egl.SwapBuffersWithDamageKHR.is_loaded() } + #[inline] + #[cfg(target_os = "android")] + pub fn swap_buffers_with_damage_supported(&self) -> bool { + true + } + #[inline] pub fn get_pixel_format(&self) -> PixelFormat { self.pixel_format.clone()