about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-04 18:16:53 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-04 18:16:53 +0300
commit37ed5375459b04a8974063b67ebaaeca5c2ab0c5 (patch)
treefd4adf5c625637e877bc1baf12b588d46dfb103e
parent493ae133d87fff8269376cded4a2e0cdae30b607 (diff)
downloadfungus-launcher-37ed5375459b04a8974063b67ebaaeca5c2ab0c5.tar.gz
fungus-launcher-37ed5375459b04a8974063b67ebaaeca5c2ab0c5.tar.xz
hide/appear splash screen instead of trying to close and recreate it
-rw-r--r--fungus/run_manager.py4
-rw-r--r--fungus/splash_window.py20
2 files changed, 18 insertions, 6 deletions
diff --git a/fungus/run_manager.py b/fungus/run_manager.py
index c9fa3c2..b53f1b8 100644
--- a/fungus/run_manager.py
+++ b/fungus/run_manager.py
@@ -115,10 +115,10 @@ def handle_command(
         log.error("GameLauncher error: %s", msg)
 
     def on_process_exit() -> None:
-        log.debug("on_process_exit: closing splash and quitting GTK")
+        log.debug("on_process_exit: destroying splash and quitting GTK")
         s = splash_container[0]
         if s is not None:
-            GLib.idle_add(s.close)
+            GLib.idle_add(s._destroy)
         GLib.idle_add(Gtk.main_quit)
 
     def on_sandbox_warning(exec_path: str, valid_dirs: list[str]) -> None:
diff --git a/fungus/splash_window.py b/fungus/splash_window.py
index f18918c..4102644 100644
--- a/fungus/splash_window.py
+++ b/fungus/splash_window.py
@@ -124,6 +124,9 @@ class SplashWindow:
         """
         assert self._window is not None
 
+        # Reveal the window if it was hidden when the game started
+        self._window.show_all()
+
         # Update window title with exit code
         current_title = self._window.get_title() or ""
         self._window.set_title(f"{current_title} — exited with code {exit_code}")
@@ -142,15 +145,24 @@ class SplashWindow:
             self._close_button.set_sensitive(True)
 
     def close(self) -> None:
+        """Hide the splash window.
+
+        Called when the game has started — the window is kept alive so
+        output can continue to be written and it can be shown again if
+        the game exits with an error.
+        """
+        if self._window is not None:
+            self._window.hide()
+
+    def _destroy(self) -> None:
         """Destroy the splash window and invoke the close callback.
 
-        The callback is cleared after the first invocation to prevent
-        an infinite loop: ``close()`` → ``_on_close()`` → ``idle_add(close)``
-        → ``close()`` → …
+        Called during final cleanup (process exit).  The callback is
+        cleared after the first invocation to prevent an infinite loop.
         """
         if self._window is not None:
             self._window.destroy()  # type: ignore[union-attr]
-        # Clear the callback so repeated close() calls are no-ops.
+        # Clear the callback so repeated _destroy() calls are no-ops.
         self._on_close()
         self._on_close = lambda: None