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