mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
e2c84725de
* Format everything and add rustfmt to travis * Remove extern crate winit from examples and add force_multiline_blocks * Format the code properly * Fix inconsistent period in PULL_REQUEST_TEMPLATE.md * Only run rustfmt on nightly * Travis fixings
34 lines
1,005 B
Rust
34 lines
1,005 B
Rust
#![cfg(any(target_os = "android"))]
|
|
|
|
use crate::{EventLoop, Window, WindowBuilder};
|
|
use std::os::raw::c_void;
|
|
|
|
/// 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 {}
|