1 parent
702fbac2da
commit
488ad0b9c9
1 file changed
+1
-18
@@ -7,8 +7,7 @@ use crate::{
|
|||||||
shortcut::ShortcutRegistry,
|
shortcut::ShortcutRegistry,
|
||||||
webview::{PendingWebview, WebviewInstance},
|
webview::{PendingWebview, WebviewInstance},
|
||||||
};
|
};
|
||||||
use dioxus_core::{consume_context, ScopeId, VirtualDom};
|
use dioxus_core::VirtualDom;
|
||||||
use dioxus_history::History;
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
@@ -480,9 +479,6 @@ impl App {
|
|||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
fn persist_window_state(&self) {
|
fn persist_window_state(&self) {
|
||||||
use dioxus_core::ScopeId;
|
|
||||||
use dioxus_history::History;
|
|
||||||
|
|
||||||
if let Some(webview) = self.webviews.values().next() {
|
if let Some(webview) = self.webviews.values().next() {
|
||||||
let window = &webview.desktop_context.window;
|
let window = &webview.desktop_context.window;
|
||||||
|
|
||||||
@@ -518,17 +514,12 @@ impl App {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let url = webview.dom.in_scope(ScopeId::ROOT, || {
|
|
||||||
consume_context::<Rc<dyn History>>().current_route()
|
|
||||||
});
|
|
||||||
|
|
||||||
let state = PreservedWindowState {
|
let state = PreservedWindowState {
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
width: width.max(200),
|
width: width.max(200),
|
||||||
height: height.max(200),
|
height: height.max(200),
|
||||||
monitor: monitor_name.to_string(),
|
monitor: monitor_name.to_string(),
|
||||||
url: Some(url),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Yes... I know... we're loading a file that might not be ours... but it's a debug feature
|
// Yes... I know... we're loading a file that might not be ours... but it's a debug feature
|
||||||
@@ -582,13 +573,6 @@ impl App {
|
|||||||
window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1));
|
window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the url if it exists
|
|
||||||
webview.dom.in_scope(ScopeId::ROOT, || {
|
|
||||||
if let Some(url) = state.url {
|
|
||||||
consume_context::<Rc<dyn History>>().replace(url);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -627,7 +611,6 @@ struct PreservedWindowState {
|
|||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
monitor: String,
|
monitor: String,
|
||||||
url: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the location of a tempfile with our window state in it such that we can restore it later
|
/// Return the location of a tempfile with our window state in it such that we can restore it later
|
||||||
|
|||||||
Reference in new issue
Block a user