2016-04-20 03:31:36 +10:00
|
|
|
#![cfg(any(target_os = "android"))]
|
|
|
|
|
|
|
|
use std::os::raw::c_void;
|
2019-02-06 02:30:33 +11:00
|
|
|
use EventLoop;
|
2016-04-20 03:31:36 +10:00
|
|
|
use Window;
|
|
|
|
use WindowBuilder;
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// Additional methods on `EventLoop` that are specific to Android.
|
|
|
|
pub trait EventLoopExtAndroid {
|
2018-02-16 00:09:14 +11:00
|
|
|
/// Makes it possible for glutin to register a callback when a suspend event happens on Android
|
|
|
|
fn set_suspend_callback(&self, cb: Option<Box<Fn(bool) -> ()>>);
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl EventLoopExtAndroid for EventLoop {
|
2018-02-16 00:09:14 +11:00
|
|
|
fn set_suspend_callback(&self, cb: Option<Box<Fn(bool) -> ()>>) {
|
2019-02-06 02:30:33 +11:00
|
|
|
self.event_loop.set_suspend_callback(cb);
|
2018-02-16 00:09:14 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-20 03:31:36 +10:00
|
|
|
/// Additional methods on `Window` that are specific to Android.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowExtAndroid {
|
2016-04-20 03:31:36 +10:00
|
|
|
fn get_native_window(&self) -> *const c_void;
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowExtAndroid for Window {
|
2016-04-20 03:31:36 +10:00
|
|
|
#[inline]
|
|
|
|
fn get_native_window(&self) -> *const c_void {
|
|
|
|
self.window.get_native_window()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Additional methods on `WindowBuilder` that are specific to Android.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowBuilderExtAndroid {
|
2016-04-20 03:31:36 +10:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowBuilderExtAndroid for WindowBuilder {
|
2016-04-20 03:31:36 +10:00
|
|
|
}
|