diff --git a/Cargo.lock b/Cargo.lock index dafc1f5ad..ea95693b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4061,17 +4061,18 @@ dependencies = [ [[package]] name = "muda" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba8ac4080fb1e097c2c22acae467e46e4da72d941f02e82b67a87a2a89fa38b1" +checksum = "6bff4998d40ca6ec6610f958d48b57a87b62506bfccad71f49fcda0b63f19a32" dependencies = [ - "cocoa 0.26.0", "crossbeam-channel", "dpi", "gtk", "keyboard-types", "libxdo", - "objc", + "objc2", + "objc2-app-kit", + "objc2-foundation", "once_cell", "png", "serde", @@ -8178,9 +8179,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044d7738b3d50f288ddef035b793228740ad4d927f5466b0af55dc15e7e03cfe" +checksum = "f1730884cee088bb1dc1570c0a8b70a59e740ee780563407fd249e3e11ef26ff" dependencies = [ "core-graphics 0.24.0", "crossbeam-channel", diff --git a/crates/tauri/Cargo.toml b/crates/tauri/Cargo.toml index 10b982f6e..f5c9d4a27 100644 --- a/crates/tauri/Cargo.toml +++ b/crates/tauri/Cargo.toml @@ -91,8 +91,8 @@ specta = { version = "^2.0.0-rc.16", optional = true, default-features = false, ] } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies] -muda = { version = "0.14", default-features = false, features = ["serde"] } -tray-icon = { version = "0.17", default-features = false, features = [ +muda = { version = "0.15", default-features = false, features = ["serde"] } +tray-icon = { version = "0.18", default-features = false, features = [ "serde", ], optional = true } diff --git a/crates/tauri/src/manager/menu.rs b/crates/tauri/src/manager/menu.rs index 63078b7e0..2695dd115 100644 --- a/crates/tauri/src/manager/menu.rs +++ b/crates/tauri/src/manager/menu.rs @@ -76,7 +76,7 @@ impl MenuManager { let theme = theme .map(crate::menu::map_to_menu_theme) .unwrap_or(muda::MenuTheme::Auto); - let _ = menu.inner().init_for_hwnd_with_theme(raw.hwnd as _, theme); + let _ = unsafe { menu.inner().init_for_hwnd_with_theme(raw.hwnd as _, theme) }; } #[cfg(any( target_os = "linux", diff --git a/crates/tauri/src/menu/menu.rs b/crates/tauri/src/menu/menu.rs index 2ac81dbbb..550f0a8f0 100644 --- a/crates/tauri/src/menu/menu.rs +++ b/crates/tauri/src/menu/menu.rs @@ -44,9 +44,11 @@ impl ContextMenuBase for Menu { run_item_main_thread!(self, move |self_: Self| { #[cfg(target_os = "macos")] if let Ok(view) = window.ns_view() { - self_ - .inner() - .show_context_menu_for_nsview(view as _, position); + unsafe { + self_ + .inner() + .show_context_menu_for_nsview(view as _, position); + } } #[cfg(any( @@ -64,9 +66,11 @@ impl ContextMenuBase for Menu { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - self_ - .inner() - .show_context_menu_for_hwnd(hwnd.0 as _, position) + unsafe { + self_ + .inner() + .show_context_menu_for_hwnd(hwnd.0 as _, position) + } } }) } diff --git a/crates/tauri/src/menu/submenu.rs b/crates/tauri/src/menu/submenu.rs index d3a9e022a..429c88403 100644 --- a/crates/tauri/src/menu/submenu.rs +++ b/crates/tauri/src/menu/submenu.rs @@ -36,9 +36,11 @@ impl ContextMenuBase for Submenu { run_item_main_thread!(self, move |self_: Self| { #[cfg(target_os = "macos")] if let Ok(view) = window.ns_view() { - self_ - .inner() - .show_context_menu_for_nsview(view as _, position); + unsafe { + self_ + .inner() + .show_context_menu_for_nsview(view as _, position); + } } #[cfg(any( @@ -56,9 +58,11 @@ impl ContextMenuBase for Submenu { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - self_ - .inner() - .show_context_menu_for_hwnd(hwnd.0 as _, position) + unsafe { + self_ + .inner() + .show_context_menu_for_hwnd(hwnd.0 as _, position) + } } }) } diff --git a/crates/tauri/src/window/mod.rs b/crates/tauri/src/window/mod.rs index a4143427c..6a92e5746 100644 --- a/crates/tauri/src/window/mod.rs +++ b/crates/tauri/src/window/mod.rs @@ -1142,7 +1142,7 @@ tauri::Builder::default() .map(crate::menu::map_to_menu_theme) .unwrap_or(muda::MenuTheme::Auto); - let _ = menu_.inner().init_for_hwnd_with_theme(hwnd.0 as _, theme); + let _ = unsafe { menu_.inner().init_for_hwnd_with_theme(hwnd.0 as _, theme) }; } #[cfg(any( target_os = "linux", @@ -1183,7 +1183,7 @@ tauri::Builder::default() self.run_on_main_thread(move || { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - let _ = menu.inner().remove_for_hwnd(hwnd.0 as _); + let _ = unsafe { menu.inner().remove_for_hwnd(hwnd.0 as _) }; } #[cfg(any( target_os = "linux", @@ -1215,7 +1215,7 @@ tauri::Builder::default() self.run_on_main_thread(move || { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - let _ = menu_.inner().hide_for_hwnd(hwnd.0 as _); + let _ = unsafe { menu_.inner().hide_for_hwnd(hwnd.0 as _) }; } #[cfg(any( target_os = "linux", @@ -1243,7 +1243,7 @@ tauri::Builder::default() self.run_on_main_thread(move || { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - let _ = menu_.inner().show_for_hwnd(hwnd.0 as _); + let _ = unsafe { menu_.inner().show_for_hwnd(hwnd.0 as _) }; } #[cfg(any( target_os = "linux", @@ -1272,7 +1272,7 @@ tauri::Builder::default() self.run_on_main_thread(move || { #[cfg(windows)] if let Ok(hwnd) = window.hwnd() { - let _ = tx.send(menu_.inner().is_visible_on_hwnd(hwnd.0 as _)); + let _ = tx.send(unsafe { menu_.inner().is_visible_on_hwnd(hwnd.0 as _) }); } #[cfg(any( target_os = "linux",