mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
* Remove UnownedWindow::inner_rect * Refactor custom view to use much less `unsafe` The compiler fence is safe to get rid of now since `interpretKeyEvents` takes `&mut self` * Refactor Window to use much less unsafe * Refactor NSApplication usage to have much less unsafe * Remove cocoa dependency * Enable `deny(unsafe_op_in_unsafe_fn)` on macOS Also re-enable clippy `let_unit_value` lint * Remove #[macro_use] on macOS * Refactor window delegate to use much less unsafe
25 lines
586 B
Rust
25 lines
586 B
Rust
use objc2::foundation::{NSArray, NSObject};
|
|
use objc2::rc::Shared;
|
|
use objc2::{extern_class, extern_methods, ClassType};
|
|
|
|
use super::NSEvent;
|
|
|
|
extern_class!(
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
|
pub(crate) struct NSResponder;
|
|
|
|
unsafe impl ClassType for NSResponder {
|
|
type Super = NSObject;
|
|
}
|
|
);
|
|
|
|
// Documented as "Thread-Unsafe".
|
|
|
|
extern_methods!(
|
|
unsafe impl NSResponder {
|
|
// TODO: Allow "immutably" on main thread
|
|
#[sel(interpretKeyEvents:)]
|
|
pub unsafe fn interpretKeyEvents(&mut self, events: &NSArray<NSEvent, Shared>);
|
|
}
|
|
);
|