(path_ptr: *const u8)
| 2212 | |
| 2213 | #[no_mangle] |
| 2214 | pub extern "C" fn bloom_set_window_icon(path_ptr: *const u8) { |
| 2215 | let path = str_from_header(path_ptr); |
| 2216 | unsafe { |
| 2217 | let ns_path = NSString::from_str(path); |
| 2218 | let image_cls = objc2::runtime::AnyClass::get(c"NSImage").unwrap(); |
| 2219 | let image: *mut objc2::runtime::AnyObject = |
| 2220 | msg_send![image_cls, alloc]; |
| 2221 | if image.is_null() { return; } |
| 2222 | let image: *mut objc2::runtime::AnyObject = |
| 2223 | msg_send![image, initWithContentsOfFile: &*ns_path]; |
| 2224 | if image.is_null() { return; } |
| 2225 | let app = NSApplication::sharedApplication(MainThreadMarker::new_unchecked()); |
| 2226 | let _: () = msg_send![&*app, setApplicationIconImage: image]; |
| 2227 | } |
| 2228 | } |
| 2229 | |
| 2230 | extern "C" { |
| 2231 | fn CGDisplayHideCursor(display: u32) -> i32; |
nothing calls this directly
no test coverage detected