Skip to content

Commit

Permalink
update wry to 0.45 and muda to 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Sep 26, 2024
1 parent 0c1905c commit 359a48e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 37 deletions.
61 changes: 31 additions & 30 deletions v2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ env_logger = { version = "0.11.3", default-features = false, features = ["auto-c
lexopt = "0.3.0"
log = "0.4.20"
memchr = "2.7.1"
muda = "0.14.0"
muda = "0.15.0"
notify = "6.1.1"
once_cell = "1.19.0"
open = "5.0.1"
Expand All @@ -55,13 +55,13 @@ serde_yaml = "0.9.30"
tao = { version = "0.30.0", default-features = false, features = [ "rwh_06" ] }

[target.'cfg(target_os = "macos")'.dependencies]
wry = { version = "0.44.0", features = ["transparent"] }
wry = { version = "0.45.0", features = ["transparent"] }
window-vibrancy = "0.5.0"
objc = "0.2.7"
core-graphics = "0.24.0"

[target.'cfg(not(target_os = "macos"))'.dependencies]
wry = "0.44.0"
wry = "0.45.0"

[target.'cfg(windows)'.dependencies]
windows = { version = "0.58.0", features = ["Win32_Foundation", "Win32_System_Console", "Win32_UI_WindowsAndMessaging"] }
Expand Down
20 changes: 16 additions & 4 deletions v2/src/wry/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,11 @@ impl Menu {
let id = window.id();
match self.visibility.entry(id) {
Entry::Vacant(entry) => {
// Safety: Using the handle returned from `Window::hwnd`.
#[cfg(target_os = "windows")]
self.menu_bar.init_for_hwnd(window.hwnd() as _)?;
unsafe {
self.menu_bar.init_for_hwnd(window.hwnd() as _)?;
}
#[cfg(target_os = "linux")]
self.menu_bar.init_for_gtk_window(window.gtk_window(), window.default_vbox())?;
#[cfg(target_os = "macos")]
Expand All @@ -289,14 +292,20 @@ impl Menu {
Entry::Occupied(entry) => {
let visible = entry.into_mut();
if *visible {
// Safety: Using the handle returned from `Window::hwnd`.
#[cfg(target_os = "windows")]
self.menu_bar.hide_for_hwnd(window.hwnd() as _)?;
unsafe {
self.menu_bar.hide_for_hwnd(window.hwnd() as _)?;
}
#[cfg(target_os = "linux")]
self.menu_bar.hide_for_gtk_window(window.gtk_window())?;
log::debug!("Hide menu on window (id={:?})", id);
} else {
// Safety: Using the handle returned from `Window::hwnd`.
#[cfg(target_os = "windows")]
self.menu_bar.show_for_hwnd(window.hwnd() as _)?;
unsafe {
self.menu_bar.show_for_hwnd(window.hwnd() as _)?;
}
#[cfg(target_os = "linux")]
self.menu_bar.show_for_gtk_window(window.gtk_window())?;
log::debug!("Show menu on window (id={:?})", id);
Expand All @@ -314,7 +323,10 @@ impl Menu {
self.menu_bar.show_context_menu_for_hwnd(window.hwnd() as _, position);
#[cfg(target_os = "linux")]
self.menu_bar.show_context_menu_for_gtk_window(window.gtk_window().as_ref(), position);
// Safety: Using the pointer returned from `Window::ns_view`.
#[cfg(target_os = "macos")]
self.menu_bar.show_context_menu_for_nsview(window.ns_view() as _, position);
unsafe {
self.menu_bar.show_context_menu_for_nsview(window.ns_view() as _, position);
}
}
}

0 comments on commit 359a48e

Please sign in to comment.