Fix full screen message to the webview

This commit is contained in:
Vladimir Borisov 2024-04-22 14:14:08 +03:00
parent b8c68029ed
commit b6c957a42c

View file

@ -70,27 +70,19 @@ pub struct MainWindow {
}
impl MainWindow {
fn transmit_window_full_screen_change(&self, prevent_close: bool) {
fn transmit_window_full_screen_change(&self, full_screen: bool, prevent_close: bool) {
let web_channel = self.webview.channel.borrow();
let (web_tx, _) = web_channel
.as_ref()
.expect("Cannont obtain communication channel for the Web UI");
let web_tx_app = web_tx.clone();
let full_screen = {
self.saved_window_style
.try_borrow()
.ok()
.map(|saved_style| saved_style.full_screen)
};
if let Some(full_screen) = full_screen {
web_tx_app
.send(RPCResponse::visibility_change(
self.window.visible(),
prevent_close as u32,
full_screen,
))
.ok();
}
web_tx_app
.send(RPCResponse::visibility_change(
self.window.visible(),
prevent_close as u32,
full_screen,
))
.ok();
}
fn transmit_window_state_change(&self) {
if let (Some(hwnd), Ok(web_channel), Ok(style)) = (
@ -327,7 +319,7 @@ impl MainWindow {
self.tray
.tray_topmost
.set_checked((saved_style.ex_style as u32 & WS_EX_TOPMOST) == WS_EX_TOPMOST);
self.transmit_window_full_screen_change(true);
self.transmit_window_full_screen_change(saved_style.full_screen, true);
}
}
}
@ -363,7 +355,7 @@ impl MainWindow {
}
self.window.set_visible(false);
self.tray.tray_show_hide.set_checked(self.window.visible());
self.transmit_window_full_screen_change(false);
self.transmit_window_full_screen_change(false, false);
// Terminates the app regardless if the user is set exit on window closed or not
// nwg::stop_thread_dispatch();
}