mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 06:33:45 +08:00
fix: restore the window state first, then set the window size
This commit is contained in:
parent
f08d2c998d
commit
a14c3f81b0
@ -121,7 +121,6 @@ pub fn quit(code: Option<i32>) {
|
|||||||
handle::Handle::global().set_is_exiting();
|
handle::Handle::global().set_is_exiting();
|
||||||
resolve::resolve_reset();
|
resolve::resolve_reset();
|
||||||
log_err!(handle::Handle::global().get_window().unwrap().close());
|
log_err!(handle::Handle::global().get_window().unwrap().close());
|
||||||
println!("saving window state");
|
|
||||||
match app_handle.save_window_state(StateFlags::all()) {
|
match app_handle.save_window_state(StateFlags::all()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("window state saved successfully");
|
println!("window state saved successfully");
|
||||||
|
@ -141,9 +141,9 @@ pub fn create_window() {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let window = builder
|
let window = builder
|
||||||
.decorations(false)
|
.decorations(false)
|
||||||
|
.maximizable(true)
|
||||||
.additional_browser_args("--enable-features=msWebView2EnableDraggableRegions --disable-features=OverscrollHistoryNavigation,msExperimentalScrolling")
|
.additional_browser_args("--enable-features=msWebView2EnableDraggableRegions --disable-features=OverscrollHistoryNavigation,msExperimentalScrolling")
|
||||||
.transparent(true)
|
.transparent(true)
|
||||||
.inner_size(800.0, 636.0)
|
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
|
|
||||||
@ -152,7 +152,6 @@ pub fn create_window() {
|
|||||||
.decorations(true)
|
.decorations(true)
|
||||||
.hidden_title(true)
|
.hidden_title(true)
|
||||||
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
||||||
.inner_size(800.0, 642.0)
|
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -160,11 +159,9 @@ pub fn create_window() {
|
|||||||
let window = builder
|
let window = builder
|
||||||
.decorations(false)
|
.decorations(false)
|
||||||
.transparent(true)
|
.transparent(true)
|
||||||
.inner_size(800.0, 642.0)
|
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!("restore window state");
|
|
||||||
match window.restore_state(StateFlags::all()) {
|
match window.restore_state(StateFlags::all()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("window state restored successfully");
|
println!("window state restored successfully");
|
||||||
@ -173,6 +170,21 @@ pub fn create_window() {
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("failed to restore window state: {}", e);
|
println!("failed to restore window state: {}", e);
|
||||||
log::error!(target: "app", "failed to restore window state: {}", e);
|
log::error!(target: "app", "failed to restore window state: {}", e);
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
window
|
||||||
|
.set_size(tauri::Size::Physical(tauri::PhysicalSize {
|
||||||
|
width: 800,
|
||||||
|
height: 636,
|
||||||
|
}))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
window
|
||||||
|
.set_size(tauri::Size::Physical(tauri::PhysicalSize {
|
||||||
|
width: 800,
|
||||||
|
height: 642,
|
||||||
|
}))
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user