Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventloop v2 #1146

Merged
merged 7 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ members = [
"glutin_gles2_sys",
"glutin_emscripten_sys",
]

[replace]
#"winit:0.19.0" = { path = "../winit" }
7 changes: 4 additions & 3 deletions glutin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ documentation = "https://docs.rs/glutin"
edition = "2018"

[package.metadata.docs.rs]
features = ["icon_loading", "serde"]
features = ["serde"]

[features]
icon_loading = ["winit/icon_loading"]
serde = ["winit/serde"]

[dependencies]
lazy_static = "1.3"
winit = "^0.19.1"
#winit = "^0.19.1"
winit = { git = "https://github.com/rust-windowing/winit.git", branch = "eventloop-2.0"}

[target.'cfg(target_os = "android")'.dependencies]
android_glue = "0.2"
Expand Down Expand Up @@ -62,3 +62,4 @@ glutin_egl_sys = { version = "0.1.3", path = "../glutin_egl_sys" }
glutin_glx_sys = { version = "0.1.5", path = "../glutin_glx_sys" }
derivative = "1.0"
parking_lot = "0.7"
log = "0.4"
16 changes: 9 additions & 7 deletions glutin/src/api/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use crate::{
Api, ContextError, GlAttributes, PixelFormat, PixelFormatRequirements,
};

use crate::platform::android::EventLoopExtAndroid;
use glutin_egl_sys as ffi;
use parking_lot::Mutex;
use winit;
use winit::dpi;
use winit::os::android::EventsLoopExt;

use std::sync::Arc;

Expand Down Expand Up @@ -51,12 +51,12 @@ impl android_glue::SyncEventHandler for AndroidSyncEventHandler {

impl Context {
#[inline]
pub fn new_windowed(
wb: winit::WindowBuilder,
el: &winit::EventsLoop,
pub fn new_windowed<T>(
wb: winit::window::WindowBuilder,
el: &winit::event_loop::EventLoop<T>,
pf_reqs: &PixelFormatRequirements,
gl_attr: &GlAttributes<&Self>,
) -> Result<(winit::Window, Self), CreationError> {
) -> Result<(winit::window::Window, Self), CreationError> {
let win = wb.build(el)?;
let gl_attr = gl_attr.clone().map_sharing(|c| &c.0.egl_context);
let nwin = unsafe { android_glue::get_native_window() };
Expand All @@ -69,6 +69,7 @@ impl Context {
&gl_attr,
native_display,
EglSurfaceType::Window,
|c, _| Ok(c[0]),
)
.and_then(|p| p.finish(nwin as *const _))?;
let ctx = Arc::new(AndroidContext {
Expand Down Expand Up @@ -103,8 +104,8 @@ impl Context {
}

#[inline]
pub fn new_headless(
_el: &winit::EventsLoop,
pub fn new_headless<T>(
_el: &winit::event_loop::EventLoop<T>,
pf_reqs: &PixelFormatRequirements,
gl_attr: &GlAttributes<&Context>,
size: dpi::PhysicalSize,
Expand All @@ -115,6 +116,7 @@ impl Context {
&gl_attr,
NativeDisplay::Android,
EglSurfaceType::PBuffer,
|c, _| Ok(c[0]),
)?;
let egl_context = context.finish_pbuffer(size)?;
let ctx = Arc::new(AndroidContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::ffi::CString;
use std::ops::{Deref, DerefMut};
use std::sync::Arc;

#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct SymWrapper<T> {
inner: T,
_lib: Arc<Library>,
Expand Down
Loading