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" log = "0.4"
serde = { version = "1", optional = true, features = ["serde_derive"] } serde = { version = "1", optional = true, features = ["serde_derive"] }
derivative = "1.0.2" derivative = "1.0.2"
raw-window-handle = "0.1" raw-window-handle = "0.2"
[dev-dependencies] [dev-dependencies]
image = "0.21" image = "0.21"

View file

@ -19,6 +19,7 @@ use crate::{
CreationError, CursorIcon, Event, LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, CreationError, CursorIcon, Event, LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize,
WindowAttributes, WindowEvent, WindowId as RootWindowId, WindowAttributes, WindowEvent, WindowId as RootWindowId,
}; };
use raw_window_handle::{android::AndroidHandle, RawWindowHandle};
use CreationError::OsError; use CreationError::OsError;
pub type OsError = std::io::Error; pub type OsError = std::io::Error;
@ -421,6 +422,15 @@ impl Window {
pub fn id(&self) -> WindowId { pub fn id(&self) -> WindowId {
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 {} unsafe impl Send for Window {}

View file

@ -461,7 +461,7 @@ impl Window {
pub fn raw_window_handle(&self) -> RawWindowHandle { pub fn raw_window_handle(&self) -> RawWindowHandle {
match self { 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()), &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::{ use std::{
cmp, cmp,
collections::HashSet, collections::HashSet,
@ -1296,11 +1296,11 @@ impl UnownedWindow {
} }
#[inline] #[inline]
pub fn raw_window_handle(&self) -> X11Handle { pub fn raw_window_handle(&self) -> XlibHandle {
X11Handle { XlibHandle {
window: self.xwindow, window: self.xwindow,
display: self.xconn.display as _, display: self.xconn.display as _,
..X11Handle::empty() ..XlibHandle::empty()
} }
} }
} }