Skip to content

Commit

Permalink
Update macos backend for rwh 0.6 and remove dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtzxporter committed Jan 18, 2024
1 parent 980ce79 commit cb6599d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/backend/macos/file_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use crate::{FileDialog, FileHandle};

use std::path::PathBuf;

pub use objc::runtime::{BOOL, NO};

use super::modal_future::ModalFuture;
use super::utils::{run_on_main, INSWindow, NSWindow};

Expand Down
8 changes: 6 additions & 2 deletions src/backend/macos/utils/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ pub trait INSWindow: INSObject {
fn from_raw_window_handle(h: &RawWindowHandle) -> Id<Self> {
match h {
RawWindowHandle::AppKit(h) => {
let id = h.ns_window as *mut Self;
unsafe { Id::from_ptr(id) }
let id = h.ns_view.as_ptr() as *mut Self;
let id: Id<Self> = unsafe { Id::from_ptr(id) };

let window: *mut NSWindow = unsafe { msg_send![id, window] };

unsafe { Id::from_ptr(window as *mut Self) }
}
_ => unreachable!("unsupported window handle, expected: MacOS"),
}
Expand Down

0 comments on commit cb6599d

Please sign in to comment.