Skip to content

Commit acde63b

Browse files
committed
chore: explicitly show, focus and close splash
1 parent 6415f91 commit acde63b

File tree

1 file changed

+16
-5
lines changed
  • fixtures/e2e-apps/tauri/src-tauri/src

1 file changed

+16
-5
lines changed

fixtures/e2e-apps/tauri/src-tauri/src/main.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,29 @@ async fn generate_test_logs(app: tauri::AppHandle) -> Result<(), String> {
195195
}
196196

197197
fn create_main_window<R: tauri::Runtime>(app: &tauri::AppHandle<R>) -> tauri::WebviewWindow<R> {
198+
eprintln!("[Tauri-DEBUG] create_main_window called");
198199
if let Some(existing) = app.get_webview_window("main") {
200+
eprintln!("[Tauri-DEBUG] Found existing main window, returning it");
199201
return existing;
200202
}
201-
tauri::WebviewWindowBuilder::new(
203+
eprintln!("[Tauri-DEBUG] Creating new main window");
204+
let window = tauri::WebviewWindowBuilder::new(
202205
app,
203206
"main",
204207
tauri::WebviewUrl::App("index.html".into())
205208
)
206209
.title("Tauri E2E Test App")
207210
.inner_size(600.0, 400.0)
208211
.build()
209-
.expect("Failed to create main window")
212+
.expect("Failed to create main window");
213+
eprintln!("[Tauri-DEBUG] Main window created successfully");
214+
window
210215
}
211216

212217
#[tauri::command]
213218
async fn switch_to_main(app: tauri::AppHandle) -> Result<(), String> {
214219
if let Some(splash) = app.get_webview_window("splash") {
215-
splash.hide().map_err(|e| e.to_string())?;
220+
splash.close().map_err(|e| e.to_string())?;
216221
}
217222

218223
let main = app.get_webview_window("main")
@@ -235,7 +240,7 @@ fn main() {
235240
if is_splash {
236241
// Only create the splash window when splash is enabled
237242
// This matches the Electron behavior - main window is created lazily via switch_to_main
238-
let _splash = tauri::WebviewWindowBuilder::new(
243+
let splash = tauri::WebviewWindowBuilder::new(
239244
app,
240245
"splash",
241246
tauri::WebviewUrl::App("splash.html".into())
@@ -245,9 +250,15 @@ fn main() {
245250
.resizable(false)
246251
.decorations(false)
247252
.transparent(true)
253+
.focused(true)
248254
.build()
249255
.expect("Failed to create splash window");
250-
eprintln!("[Tauri-DEBUG] Created splash window only");
256+
257+
// Show and focus the splash window explicitly
258+
splash.show().expect("Failed to show splash window");
259+
splash.set_focus().expect("Failed to focus splash window");
260+
261+
eprintln!("[Tauri-DEBUG] Created, showed, and focused splash window");
251262
} else {
252263
create_main_window(app.handle());
253264
}

0 commit comments

Comments
 (0)