MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bloom_set_window_icon

Function bloom_set_window_icon

native/macos/src/lib.rs:2214–2228  ·  view source on GitHub ↗
(path_ptr: *const u8)

Source from the content-addressed store, hash-verified

2212
2213#[no_mangle]
2214pub 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
2230extern "C" {
2231 fn CGDisplayHideCursor(display: u32) -> i32;

Callers

nothing calls this directly

Calls 2

str_from_headerFunction · 0.85
getFunction · 0.85

Tested by

no test coverage detected