From bef9f2845e14cf5b7955a39ba5cc262a96e548b8 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 23 Jun 2021 12:05:58 -0300 Subject: [PATCH] fix: build without `menu` feature --- core/tauri-runtime-wry/src/lib.rs | 10 +++++++--- core/tauri-runtime-wry/src/menu.rs | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index b465e417a..4ada1045c 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -1517,8 +1517,9 @@ fn handle_event_loop( callback, window_id, &mut webviews, - menu_event_listeners.clone(), control_flow, + #[cfg(feature = "menu")] + menu_event_listeners.clone(), ); } WryWindowEvent::Resized(_) => { @@ -1612,8 +1613,9 @@ fn handle_event_loop( callback, id, &mut webviews, - menu_event_listeners.clone(), control_flow, + #[cfg(feature = "menu")] + menu_event_listeners.clone(), ); } WindowMessage::SetDecorations(decorations) => window.set_decorations(decorations), @@ -1786,10 +1788,12 @@ fn on_window_close<'a>( callback: &'a (dyn Fn(RunEvent) + 'static), window_id: WindowId, webviews: &mut MutexGuard<'a, HashMap>, - menu_event_listeners: MenuEventListeners, control_flow: &mut ControlFlow, + #[cfg(feature = "menu")] + menu_event_listeners: MenuEventListeners, ) { if let Some(webview) = webviews.remove(&window_id) { + #[cfg(feature = "menu")] menu_event_listeners.lock().unwrap().remove(&window_id); callback(RunEvent::WindowClose(webview.label)); } diff --git a/core/tauri-runtime-wry/src/menu.rs b/core/tauri-runtime-wry/src/menu.rs index a821e2ec7..597543db8 100644 --- a/core/tauri-runtime-wry/src/menu.rs +++ b/core/tauri-runtime-wry/src/menu.rs @@ -38,8 +38,11 @@ use std::{ sync::{Arc, Mutex}, }; +#[cfg(feature = "menu")] pub type MenuEventHandler = Box; +#[cfg(feature = "menu")] pub type MenuEventListeners = Arc>>; +#[cfg(feature = "menu")] pub type WindowMenuEventListeners = Arc>>; #[cfg(feature = "system-tray")]