Skip to content

Commit

Permalink
No glue.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Feb 10, 2020
1 parent e179a70 commit 60c8611
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 197 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ image = "0.22.4"
simple_logger = "1.4.0"

[target.'cfg(target_os = "android")'.dependencies]
android_glue = { git = "https://github.com/rust-windowing/android-rs-glue" }
android-ndk = { git = "https://github.com/rust-windowing/android-ndk-rs" }
android-ndk-sys = { git = "https://github.com/rust-windowing/android-ndk-rs" }
android-glue = { path = "../../android-ndk-rs/android-glue" }
android-ndk = { path = "../../android-ndk-rs/android-ndk", default-features = false }
android-ndk-sys = { path = "../../android-ndk-rs/android-ndk-sys", default-features = false }

[target.'cfg(target_os = "ios")'.dependencies]
objc = "0.2.7"
Expand Down
22 changes: 10 additions & 12 deletions src/platform/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use glutin_interface::{
AndroidWindowParts, NativeDisplay, NativeWindow, NativeWindowSource, RawDisplay, RawWindow,
Seal,
};
use std::os::raw;
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use winit_types::dpi::PhysicalSize;
use winit_types::error::Error;

Expand All @@ -19,15 +19,9 @@ impl<T> EventLoopExtAndroid for EventLoop<T> {}
pub trait EventLoopWindowTargetExtAndroid {}

/// Additional methods on `Window` that are specific to Android.
pub trait WindowExtAndroid {
fn a_native_window(&self) -> *const *mut raw::c_void;
}
pub trait WindowExtAndroid {}

impl WindowExtAndroid for Window {
fn a_native_window(&self) -> *const *mut raw::c_void {
self.window.a_native_window()
}
}
impl WindowExtAndroid for Window {}

/// Additional methods on `WindowBuilder` that are specific to Android.
pub trait WindowBuilderExtAndroid {}
Expand All @@ -36,9 +30,13 @@ impl WindowBuilderExtAndroid for WindowBuilder {}

impl NativeWindow for Window {
fn raw_window(&self) -> RawWindow {
RawWindow::Android {
a_native_window: self.a_native_window(),
_non_exhaustive_do_not_use: Seal,
if let RawWindowHandle::Android(handle) = self.raw_window_handle() {
RawWindow::Android {
a_native_window: handle.a_native_window,
_non_exhaustive_do_not_use: Seal,
}
} else {
unreachable!()
}
}

Expand Down
Loading

0 comments on commit 60c8611

Please sign in to comment.