修复folder窗口的大小状态未保持上次的位置和状态
This commit is contained in:
@@ -16,6 +16,10 @@ pub struct CommitWindowState {
|
|||||||
owner_by_commit_label: Mutex<HashMap<String, String>>,
|
owner_by_commit_label: Mutex<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn folder_window_label(folder_id: i32) -> String {
|
||||||
|
format!("folder-{folder_id}")
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn apply_platform_window_style<'a, R, M>(
|
pub(crate) fn apply_platform_window_style<'a, R, M>(
|
||||||
builder: WebviewWindowBuilder<'a, R, M>,
|
builder: WebviewWindowBuilder<'a, R, M>,
|
||||||
) -> WebviewWindowBuilder<'a, R, M>
|
) -> WebviewWindowBuilder<'a, R, M>
|
||||||
@@ -208,8 +212,19 @@ pub async fn open_folder_window(
|
|||||||
.await
|
.await
|
||||||
.map_err(AppCommandError::from)?;
|
.map_err(AppCommandError::from)?;
|
||||||
|
|
||||||
// Create folder window with unique label
|
let label = folder_window_label(entry.id);
|
||||||
let label = format!("folder-{}", uuid::Uuid::new_v4());
|
if let Some(existing) = app.get_webview_window(&label) {
|
||||||
|
ensure_windows_undecorated(&existing);
|
||||||
|
let _ = existing.unminimize();
|
||||||
|
existing.set_focus().map_err(|e| {
|
||||||
|
AppCommandError::window("Failed to focus folder window", e.to_string())
|
||||||
|
})?;
|
||||||
|
if let Some(w) = app.get_webview_window("welcome") {
|
||||||
|
let _ = w.close();
|
||||||
|
}
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let url = WebviewUrl::App(format!("folder?id={}", entry.id).into());
|
let url = WebviewUrl::App(format!("folder?id={}", entry.id).into());
|
||||||
let builder = WebviewWindowBuilder::new(&app, &label, url)
|
let builder = WebviewWindowBuilder::new(&app, &label, url)
|
||||||
.title(&entry.name)
|
.title(&entry.name)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ pub fn run() {
|
|||||||
let _ = windows::open_welcome_window(app.handle());
|
let _ = windows::open_welcome_window(app.handle());
|
||||||
} else {
|
} else {
|
||||||
for entry in &open_folders {
|
for entry in &open_folders {
|
||||||
let label = format!("folder-{}", uuid::Uuid::new_v4());
|
let label = windows::folder_window_label(entry.id);
|
||||||
let url = tauri::WebviewUrl::App(format!("folder?id={}", entry.id).into());
|
let url = tauri::WebviewUrl::App(format!("folder?id={}", entry.id).into());
|
||||||
let builder = tauri::WebviewWindowBuilder::new(app, &label, url)
|
let builder = tauri::WebviewWindowBuilder::new(app, &label, url)
|
||||||
.title(&entry.name)
|
.title(&entry.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user