Added close behaviour option for specific window (#3754)
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
c3c7e5f705
commit
9573af115a
10 files changed
+172
-28
No files matched your search
@@ -6,7 +6,7 @@ use crate::{
|
||||
query::QueryEngine,
|
||||
shortcut::{HotKey, HotKeyState, ShortcutHandle, ShortcutRegistryError},
|
||||
webview::PendingWebview,
|
||||
AssetRequest, Config, WryEventHandler,
|
||||
AssetRequest, Config, WindowCloseBehaviour, WryEventHandler,
|
||||
};
|
||||
use dioxus_core::{prelude::Callback, VirtualDom};
|
||||
use std::{
|
||||
@@ -181,6 +181,26 @@ impl DesktopService {
|
||||
.send_event(UserWindowEvent::CloseWindow(id));
|
||||
}
|
||||
|
||||
/// Change close behaviour of this window
|
||||
pub fn change_close_behaviour(&self, behaviour: Option<WindowCloseBehaviour>) {
|
||||
let _ = self
|
||||
.shared
|
||||
.proxy
|
||||
.send_event(UserWindowEvent::CloseBehaviour(self.id(), behaviour));
|
||||
}
|
||||
|
||||
/// Change close behaviour of a specific window, given its ID
|
||||
pub fn change_window_close_behaviour(
|
||||
&self,
|
||||
id: WindowId,
|
||||
behaviour: Option<WindowCloseBehaviour>,
|
||||
) {
|
||||
let _ = self
|
||||
.shared
|
||||
.proxy
|
||||
.send_event(UserWindowEvent::CloseBehaviour(id, behaviour));
|
||||
}
|
||||
|
||||
/// change window to fullscreen
|
||||
pub fn set_fullscreen(&self, fullscreen: bool) {
|
||||
if let Some(handle) = &self.window.current_monitor() {
|
||||
|
||||
Reference in new issue
Block a user