2016-04-20 03:31:36 +10:00
|
|
|
#![cfg(any(target_os = "android"))]
|
|
|
|
|
|
|
|
use std::os::raw::c_void;
|
2019-06-18 04:27:00 +10:00
|
|
|
use crate::EventLoop;
|
|
|
|
use crate::Window;
|
|
|
|
use crate::WindowBuilder;
|
2016-04-20 03:31:36 +10:00
|
|
|
|
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
|
2019-06-18 04:27:00 +10:00
|
|
|
fn set_suspend_callback(&self, cb: Option<Box<dyn Fn(bool) -> ()>>);
|
2018-02-16 00:09:14 +11:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl EventLoopExtAndroid for EventLoop {
|
2019-06-18 04:27:00 +10:00
|
|
|
fn set_suspend_callback(&self, cb: Option<Box<dyn 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 {
|
2019-05-30 11:29:54 +10:00
|
|
|
fn native_window(&self) -> *const c_void;
|
2016-04-20 03:31:36 +10:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowExtAndroid for Window {
|
2016-04-20 03:31:36 +10:00
|
|
|
#[inline]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn native_window(&self) -> *const c_void {
|
|
|
|
self.window.native_window()
|
2016-04-20 03:31:36 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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
|
|
|
}
|