mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-26 23:21:30 +11:00
f879bca21c
* Migrate to 2018 edition. * Use impl Iterator at one site. * Fix more rust 2018 idioms.
39 lines
1 KiB
Rust
39 lines
1 KiB
Rust
#![cfg(any(target_os = "android"))]
|
|
|
|
use std::os::raw::c_void;
|
|
use crate::EventLoop;
|
|
use crate::Window;
|
|
use crate::WindowBuilder;
|
|
|
|
/// Additional methods on `EventLoop` that are specific to Android.
|
|
pub trait EventLoopExtAndroid {
|
|
/// Makes it possible for glutin to register a callback when a suspend event happens on Android
|
|
fn set_suspend_callback(&self, cb: Option<Box<dyn Fn(bool) -> ()>>);
|
|
}
|
|
|
|
impl EventLoopExtAndroid for EventLoop {
|
|
fn set_suspend_callback(&self, cb: Option<Box<dyn Fn(bool) -> ()>>) {
|
|
self.event_loop.set_suspend_callback(cb);
|
|
}
|
|
}
|
|
|
|
/// Additional methods on `Window` that are specific to Android.
|
|
pub trait WindowExtAndroid {
|
|
fn native_window(&self) -> *const c_void;
|
|
}
|
|
|
|
impl WindowExtAndroid for Window {
|
|
#[inline]
|
|
fn native_window(&self) -> *const c_void {
|
|
self.window.native_window()
|
|
}
|
|
}
|
|
|
|
/// Additional methods on `WindowBuilder` that are specific to Android.
|
|
pub trait WindowBuilderExtAndroid {
|
|
|
|
}
|
|
|
|
impl WindowBuilderExtAndroid for WindowBuilder {
|
|
}
|