mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
fix (desktop): hide menu when window decorations are disabled (#2613)
* fix: hide menu when window decorations are disabled * chore: clearer doc description
This commit is contained in:
parent
bb52280a51
commit
156144e8f5
1 changed files with 13 additions and 2 deletions
|
@ -107,6 +107,13 @@ impl Config {
|
|||
// gots to do a swap because the window builder only takes itself as muy self
|
||||
// I wish more people knew about returning &mut Self
|
||||
self.window = window;
|
||||
if self.window.window.decorations {
|
||||
if self.menu.is_none() {
|
||||
self.menu = Some(default_menu_bar());
|
||||
}
|
||||
} else {
|
||||
self.menu = None;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -203,12 +210,16 @@ impl Config {
|
|||
|
||||
/// Sets the menu the window will use. This will override the default menu bar.
|
||||
///
|
||||
/// > Note: A default menu bar will be enabled unless the menu is overridden or set to `None`.
|
||||
/// > Note: Menu will be hidden if
|
||||
/// [`with_decorations`](tao::window::WindowBuilder::with_decorations)
|
||||
/// is set to false and passed into [`with_window`](Config::with_window)
|
||||
#[allow(unused)]
|
||||
pub fn with_menu(mut self, menu: impl Into<Option<DioxusMenu>>) -> Self {
|
||||
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
||||
{
|
||||
self.menu = menu.into();
|
||||
if self.window.window.decorations {
|
||||
self.menu = menu.into();
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue