fix broken / missing raw-window-handle implementation on android (#1258)

This commit is contained in:
Aaro Perämaa
2019-11-04 18:53:57 +02:00
committed by Osspial
parent 2455ab8a03
commit a815a12627
4 changed files with 15 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
# Unreleased # Unreleased
# Version 0.19.5 (2019-11-04)
- On Android, fix the missing `raw-window-handle` support
# Version 0.19.4 (2019-10-16) # Version 0.19.4 (2019-10-16)
- Add support for `raw-window-handle` 0.3. - Add support for `raw-window-handle` 0.3.

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "winit" name = "winit"
version = "0.19.4" version = "0.19.5"
authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"] authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library." description = "Cross-platform window creation library."
keywords = ["windowing"] keywords = ["windowing"]

View File

@@ -13,7 +13,7 @@ Please direct all work against `master`.
```toml ```toml
[dependencies] [dependencies]
winit = "0.19.4" winit = "0.19.5"
``` ```
## [Documentation](https://docs.rs/winit) ## [Documentation](https://docs.rs/winit)

View File

@@ -4,6 +4,7 @@ extern crate android_glue;
mod ffi; mod ffi;
use raw_window_handle::{android::AndroidHandle, RawWindowHandle};
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::fmt; use std::fmt;
@@ -422,6 +423,14 @@ impl Window {
pub fn id(&self) -> WindowId { pub fn id(&self) -> WindowId {
WindowId WindowId
} }
pub fn raw_window_handle(&self) -> RawWindowHandle {
let handle = AndroidHandle {
a_native_window: self.native_window as _,
..AndroidHandle::empty()
};
RawWindowHandle::Android(handle)
}
} }
unsafe impl Send for Window {} unsafe impl Send for Window {}