From 880b305df24d942cf1d7e9d05a3338606cf433a9 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 28 Jul 2023 14:30:00 +0200 Subject: [PATCH] Remove window handles from Apple handles (#129) The window can easily be fetched from the view, and having it leads to confusion over which place you should be e.g. taking the drawing dimensions (always the view). --- CHANGELOG.md | 1 + src/appkit.rs | 4 ---- src/uikit.rs | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8874f47..a5ce0e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * **Breaking:** `HasRaw(Display/Window)Handle::raw_(display/window)_handle` returns a result indicating if fetching the window handle failed (#122). * **Breaking:** Remove the `Active/ActiveHandle` types from the public API (#126). +* **Breaking:** Remove `AppKitWindowHandle::ns_window` and `UiKitWindowHandle::ui_window` since they can be retrived from the view (#129). ## 0.5.2 (2023-03-31) diff --git a/src/appkit.rs b/src/appkit.rs index 1023aa0..d3e66a8 100644 --- a/src/appkit.rs +++ b/src/appkit.rs @@ -30,17 +30,13 @@ impl AppKitDisplayHandle { #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct AppKitWindowHandle { - /// A pointer to an `NSWindow` object. - pub ns_window: *mut c_void, /// A pointer to an `NSView` object. pub ns_view: *mut c_void, - // TODO: WHAT ABOUT ns_window_controller and ns_view_controller? } impl AppKitWindowHandle { pub fn empty() -> Self { Self { - ns_window: ptr::null_mut(), ns_view: ptr::null_mut(), } } diff --git a/src/uikit.rs b/src/uikit.rs index bee3a9a..47f7afb 100644 --- a/src/uikit.rs +++ b/src/uikit.rs @@ -30,18 +30,15 @@ impl UiKitDisplayHandle { #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct UiKitWindowHandle { - /// A pointer to an `UIWindow` object. - pub ui_window: *mut c_void, /// A pointer to an `UIView` object. pub ui_view: *mut c_void, - /// A pointer to an `UIViewController` object. + /// A pointer to an `UIViewController` object, if the view has one. pub ui_view_controller: *mut c_void, } impl UiKitWindowHandle { pub fn empty() -> Self { Self { - ui_window: ptr::null_mut(), ui_view: ptr::null_mut(), ui_view_controller: ptr::null_mut(), }