Skip to content

Commit

Permalink
Eventloop v2 (#1146)
Browse files Browse the repository at this point in the history
* Eventloop v2

Signed-off-by: Hal Gentz <[email protected]>

* Fmt

Signed-off-by: Hal Gentz <[email protected]>

* Redraw only when requested.

Signed-off-by: Hal Gentz <[email protected]>

* Changes.

Signed-off-by: Hal Gentz <[email protected]>

* Transparency fixes and windows build fixes.

Signed-off-by: Hal Gentz <[email protected]>

* Fixes.

Signed-off-by: Hal Gentz <[email protected]>

* Fixes

Signed-off-by: Hal Gentz <[email protected]>
  • Loading branch information
goddessfreya authored May 9, 2019
1 parent 25ebd6f commit 7fa2a6a
Show file tree
Hide file tree
Showing 39 changed files with 1,207 additions and 954 deletions.
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

0 comments on commit 7fa2a6a

Please sign in to comment.