Update raw-window-handle to 0.2 (#1191)

This commit is contained in:
msiglreith 2019-09-30 17:17:01 +02:00 committed by Ryan G
parent 34348435fd
commit 18a0119b06
4 changed files with 16 additions and 6 deletions

View file

@ -20,7 +20,7 @@ libc = "0.2"
log = "0.4"
serde = { version = "1", optional = true, features = ["serde_derive"] }
derivative = "1.0.2"
raw-window-handle = "0.1"
raw-window-handle = "0.2"
[dev-dependencies]
image = "0.21"

View file

@ -19,6 +19,7 @@ use crate::{
CreationError, CursorIcon, Event, LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize,
WindowAttributes, WindowEvent, WindowId as RootWindowId,
};
use raw_window_handle::{android::AndroidHandle, RawWindowHandle};
use CreationError::OsError;
pub type OsError = std::io::Error;
@ -421,6 +422,15 @@ impl Window {
pub fn id(&self) -> WindowId {
WindowId
}
#[inline]
pub fn raw_window_handle(&self) -> RawWindowHandle {
let handle = AndroidHandle {
a_native_window: self.native_window,
..WindowsHandle::empty()
};
RawWindowHandle::Android(handle)
}
}
unsafe impl Send for Window {}

View file

@ -461,7 +461,7 @@ impl Window {
pub fn raw_window_handle(&self) -> RawWindowHandle {
match self {
&Window::X(ref window) => RawWindowHandle::X11(window.raw_window_handle()),
&Window::X(ref window) => RawWindowHandle::Xlib(window.raw_window_handle()),
&Window::Wayland(ref window) => RawWindowHandle::Wayland(window.raw_window_handle()),
}
}

View file

@ -1,4 +1,4 @@
use raw_window_handle::unix::X11Handle;
use raw_window_handle::unix::XlibHandle;
use std::{
cmp,
collections::HashSet,
@ -1296,11 +1296,11 @@ impl UnownedWindow {
}
#[inline]
pub fn raw_window_handle(&self) -> X11Handle {
X11Handle {
pub fn raw_window_handle(&self) -> XlibHandle {
XlibHandle {
window: self.xwindow,
display: self.xconn.display as _,
..X11Handle::empty()
..XlibHandle::empty()
}
}
}