Skip to content

Commit

Permalink
Remove window handles from Apple handles (#129)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
madsmtm authored Jul 28, 2023
1 parent 64d2269 commit 880b305
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 0 additions & 4 deletions src/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/uikit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down

0 comments on commit 880b305

Please sign in to comment.