diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index 294cfa23c..0b9c323c1 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -71,8 +71,10 @@ impl DesktopContext { } /// hide the menu - pub fn hide_menu(&self) { - let _ = self.proxy.send_event(UserWindowEvent::HideMenu); + pub fn set_decorations(&self, decoration: bool) { + let _ = self + .proxy + .send_event(UserWindowEvent::SetDecorations(decoration)); } } diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 452bbba96..5d45895a9 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -72,7 +72,7 @@ use tao::{ pub use wry; pub use wry::application as tao; use wry::{ - application::event_loop::EventLoopProxy, + application::{event_loop::EventLoopProxy, window::Fullscreen}, webview::RpcRequest, webview::{WebView, WebViewBuilder}, }; @@ -315,12 +315,24 @@ pub fn launch_with_props( window.set_maximized(state); } } + UserWindowEvent::Fullscreen(fullscreen) => { + for webview in desktop.webviews.values() { + let window = webview.window(); + window.set_fullscreen(*fullscreen.clone()); + } + } UserWindowEvent::FocusWindow => { for webview in desktop.webviews.values() { let window = webview.window(); window.set_focus(); } } + UserWindowEvent::Resizable(state) => { + for webview in desktop.webviews.values() { + let window = webview.window(); + window.set_resizable(state); + } + } UserWindowEvent::SetTitle(content) => { for webview in desktop.webviews.values() { @@ -328,16 +340,10 @@ pub fn launch_with_props( window.set_title(&content); } } - UserWindowEvent::Resizable(state) => { + UserWindowEvent::SetDecorations(state) => { for webview in desktop.webviews.values() { let window = webview.window(); - window.set_resizable(state); - } - } - UserWindowEvent::HideMenu => { - for webview in desktop.webviews.values() { - let window = webview.window(); - window.hide_menu(); + window.set_decorations(state); } } } @@ -360,9 +366,10 @@ pub enum UserWindowEvent { Minimize(bool), Maximize(bool), Resizable(bool), + Fullscreen(Box>), SetTitle(String), - HideMenu, + SetDecorations(bool), } pub struct DesktopController {