MCPcopy Create free account
hub / github.com/GCWing/BitFun / show_main_window_for_startup

Function show_main_window_for_startup

src/apps/desktop/src/theme.rs:653–709  ·  view source on GitHub ↗
(
    window: &tauri::WebviewWindow,
    total_started_at: Instant,
    startup_trace: &DesktopStartupTrace,
)

Source from the content-addressed store, hash-verified

651}
652
653fn show_main_window_for_startup(
654 window: &tauri::WebviewWindow,
655 total_started_at: Instant,
656 startup_trace: &DesktopStartupTrace,
657) {
658 #[cfg(target_os = "windows")]
659 {
660 let step_started_at = Instant::now();
661 if let Err(error) = window.maximize() {
662 warn!("Failed to maximize main window during startup: {}", error);
663 } else {
664 startup_trace.record_elapsed_step("native_window", "windows_maximize", step_started_at);
665 debug!(
666 "Main window startup show step completed: step=maximize duration_ms={} since_create_start_ms={}",
667 step_started_at.elapsed().as_millis(),
668 total_started_at.elapsed().as_millis()
669 );
670 }
671 let show_delay_started_at = Instant::now();
672 let show_wait_outcome = wait_for_windows_maximize_before_show(window);
673 startup_trace.record_elapsed_step(
674 "native_window",
675 "windows_show_after_maximize_wait",
676 show_delay_started_at,
677 );
678 debug!(
679 "Main window startup show step completed: step=wait_for_maximize_state outcome={} duration_ms={} since_create_start_ms={}",
680 show_wait_outcome,
681 show_delay_started_at.elapsed().as_millis(),
682 total_started_at.elapsed().as_millis()
683 );
684 }
685
686 let show_started_at = Instant::now();
687 if let Err(error) = window.show() {
688 warn!("Failed to show main window during startup: {}", error);
689 return;
690 }
691 startup_trace.record_elapsed_step("native_window", "show_window", show_started_at);
692 debug!(
693 "Main window startup show step completed: step=show duration_ms={} since_create_start_ms={}",
694 show_started_at.elapsed().as_millis(),
695 total_started_at.elapsed().as_millis()
696 );
697
698 let focus_started_at = Instant::now();
699 if let Err(error) = window.set_focus() {
700 warn!("Failed to focus main window during startup: {}", error);
701 return;
702 }
703 startup_trace.record_elapsed_step("native_window", "focus_window", focus_started_at);
704 debug!(
705 "Main window startup show step completed: step=focus duration_ms={} since_create_start_ms={}",
706 focus_started_at.elapsed().as_millis(),
707 total_started_at.elapsed().as_millis()
708 );
709}
710

Callers 1

create_main_windowFunction · 0.85

Calls 3

record_elapsed_stepMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected