mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
fix: build without menu feature
This commit is contained in:
@@ -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<WindowId, WebviewWrapper>>,
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -38,8 +38,11 @@ use std::{
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
#[cfg(feature = "menu")]
|
||||
pub type MenuEventHandler = Box<dyn Fn(&MenuEvent) + Send>;
|
||||
#[cfg(feature = "menu")]
|
||||
pub type MenuEventListeners = Arc<Mutex<HashMap<WindowId, WindowMenuEventListeners>>>;
|
||||
#[cfg(feature = "menu")]
|
||||
pub type WindowMenuEventListeners = Arc<Mutex<HashMap<Uuid, MenuEventHandler>>>;
|
||||
|
||||
#[cfg(feature = "system-tray")]
|
||||
|
||||
Reference in New Issue
Block a user