1
0
Fork 0

Impl HasRawDisplayHandle on Window, not WindowHandle

This commit is contained in:
Joakim Frostegård 2022-11-23 23:18:10 +01:00 committed by Robbert van der Helm
parent 5c23c62030
commit eb94b4d7ab
4 changed files with 25 additions and 25 deletions

View file

@ -69,12 +69,6 @@ unsafe impl HasRawWindowHandle for WindowHandle {
}
}
unsafe impl HasRawDisplayHandle for WindowHandle {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
}
}
struct ParentHandle {
_close_requested: Arc<AtomicBool>,
is_open: Arc<AtomicBool>,
@ -354,7 +348,7 @@ impl Window {
#[cfg(feature = "opengl")]
fn create_gl_context(ns_window: Option<id>, ns_view: id, config: GlConfig) -> GlContext {
let mut handle = AppKitHandle::empty();
let mut handle = AppKitWindowHandle::empty();
handle.ns_window = ns_window.unwrap_or(ptr::null_mut()) as *mut c_void;
handle.ns_view = ns_view as *mut c_void;
let handle = RawWindowHandleWrapper { handle: RawWindowHandle::AppKit(handle) };
@ -493,6 +487,12 @@ unsafe impl HasRawWindowHandle for Window {
}
}
unsafe impl HasRawDisplayHandle for Window {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
}
}
pub fn copy_to_clipboard(string: &str) {
unsafe {
let pb = NSPasteboard::generalPasteboard(nil);

View file

@ -97,12 +97,6 @@ unsafe impl HasRawWindowHandle for WindowHandle {
}
}
unsafe impl HasRawDisplayHandle for WindowHandle {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
}
}
struct ParentHandle {
is_open: Rc<Cell<bool>>,
}
@ -773,6 +767,12 @@ unsafe impl HasRawWindowHandle for Window<'_> {
}
}
unsafe impl HasRawDisplayHandle for Window<'_> {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
}
}
pub fn copy_to_clipboard(data: &str) {
todo!()
}

View file

@ -50,12 +50,6 @@ 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 {
fn on_frame(&mut self, window: &mut Window);
fn on_event(&mut self, window: &mut Window, event: Event) -> EventStatus;
@ -137,6 +131,12 @@ unsafe impl<'a> HasRawWindowHandle for Window<'a> {
}
}
unsafe impl<'a> HasRawDisplayHandle for Window<'a> {
fn raw_display_handle(&self) -> RawDisplayHandle {
self.window.raw_display_handle()
}
}
unsafe impl HasRawWindowHandle for RawWindowHandleWrapper {
fn raw_window_handle(&self) -> RawWindowHandle {
self.handle

View file

@ -64,12 +64,6 @@ unsafe impl HasRawWindowHandle for WindowHandle {
}
}
unsafe impl HasRawDisplayHandle for WindowHandle {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Xlib(XlibDisplayHandle::empty())
}
}
struct ParentHandle {
close_requested: Arc<AtomicBool>,
is_open: Arc<AtomicBool>,
@ -703,6 +697,12 @@ unsafe impl HasRawWindowHandle for Window {
}
}
unsafe impl HasRawDisplayHandle for Window {
fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Xlib(XlibDisplayHandle::empty())
}
}
fn mouse_id(id: u8) -> MouseButton {
match id {
1 => MouseButton::Left,