Upgrade to raw-window-handle 0.5, impl HasRawDisplayHandle for macOS
This commit is contained in:
parent
c129b12ead
commit
1c0490f9ec
|
@ -20,7 +20,7 @@ opengl = ["uuid", "x11/glx"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
keyboard-types = { version = "0.6.1", default-features = false }
|
keyboard-types = { version = "0.6.1", default-features = false }
|
||||||
raw-window-handle = "0.4.2"
|
raw-window-handle = "0.5"
|
||||||
|
|
||||||
[target.'cfg(target_os="linux")'.dependencies]
|
[target.'cfg(target_os="linux")'.dependencies]
|
||||||
xcb = { version = "0.9", features = ["thread", "xlib_xcb", "dri2"] }
|
xcb = { version = "0.9", features = ["thread", "xlib_xcb", "dri2"] }
|
||||||
|
|
|
@ -17,7 +17,10 @@ use keyboard_types::KeyboardEvent;
|
||||||
|
|
||||||
use objc::{msg_send, runtime::Object, sel, sel_impl};
|
use objc::{msg_send, runtime::Object, sel, sel_impl};
|
||||||
|
|
||||||
use raw_window_handle::{AppKitHandle, HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{
|
||||||
|
AppKitDisplayHandle, AppKitWindowHandle, HasRawDisplayHandle, HasRawWindowHandle,
|
||||||
|
RawDisplayHandle, RawWindowHandle,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Event, EventStatus, Size, WindowEvent, WindowHandler, WindowInfo, WindowOpenOptions,
|
Event, EventStatus, Size, WindowEvent, WindowHandler, WindowInfo, WindowOpenOptions,
|
||||||
|
@ -62,7 +65,13 @@ unsafe impl HasRawWindowHandle for WindowHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RawWindowHandle::AppKit(AppKitHandle::empty())
|
RawWindowHandle::AppKit(AppKitWindowHandle::empty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl HasRawDisplayHandle for WindowHandle {
|
||||||
|
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||||
|
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +485,7 @@ unsafe impl HasRawWindowHandle for Window {
|
||||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||||
let ns_window = self.ns_window.unwrap_or(ptr::null_mut()) as *mut c_void;
|
let ns_window = self.ns_window.unwrap_or(ptr::null_mut()) as *mut c_void;
|
||||||
|
|
||||||
let mut handle = AppKitHandle::empty();
|
let mut handle = AppKitWindowHandle::empty();
|
||||||
handle.ns_window = ns_window;
|
handle.ns_window = ns_window;
|
||||||
handle.ns_view = self.ns_view as *mut c_void;
|
handle.ns_view = self.ns_view as *mut c_void;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{
|
||||||
|
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::event::{Event, EventStatus};
|
use crate::event::{Event, EventStatus};
|
||||||
use crate::window_open_options::WindowOpenOptions;
|
use crate::window_open_options::WindowOpenOptions;
|
||||||
|
@ -48,6 +50,12 @@ unsafe impl HasRawWindowHandle for WindowHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl HasRawDisplayHandle for WindowHandle {
|
||||||
|
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||||
|
self.window_handle.raw_display_handle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait WindowHandler {
|
pub trait WindowHandler {
|
||||||
fn on_frame(&mut self, window: &mut Window);
|
fn on_frame(&mut self, window: &mut Window);
|
||||||
fn on_event(&mut self, window: &mut Window, event: Event) -> EventStatus;
|
fn on_event(&mut self, window: &mut Window, event: Event) -> EventStatus;
|
||||||
|
|
Loading…
Reference in a new issue