Fixed double window issue on Linux

This commit is contained in:
Brandon Corfman
2025-11-01 13:29:37 -04:00
parent 309cb0e2c5
commit 3cb59bd706

7
run.py
View File

@@ -93,10 +93,10 @@ if settings.get("music", True):
theme_sound.play(volume=settings.get("music_volume", 50) / 100, loop=True) theme_sound.play(volume=settings.get("music_volume", 50) / 100, loop=True)
try: try:
window = ControllerWindow(width=resolution[0], height=resolution[1], title='Game Of Life', samples=antialiasing, antialiasing=antialiasing > 0, fullscreen=fullscreen, vsync=vsync, resizable=False, style=style) window = ControllerWindow(width=resolution[0], height=resolution[1], title='Game Of Life', samples=antialiasing, antialiasing=antialiasing > 0, fullscreen=fullscreen, vsync=vsync, resizable=False, style=style, visible=False)
except (FileNotFoundError, PermissionError) as e: except (FileNotFoundError, PermissionError) as e:
logging.warning(f"Controller support unavailable: {e}. Falling back to regular window.") logging.warning(f"Controller support unavailable: {e}. Falling back to regular window.")
window = arcade.Window(width=resolution[0], height=resolution[1], title='Game Of Life', samples=antialiasing, antialiasing=antialiasing > 0, fullscreen=fullscreen, vsync=vsync, resizable=False, style=style) window = arcade.Window(width=resolution[0], height=resolution[1], title='Game Of Life', samples=antialiasing, antialiasing=antialiasing > 0, fullscreen=fullscreen, vsync=vsync, resizable=False, style=style, visible=False)
if vsync: if vsync:
window.set_vsync(True) window.set_vsync(True)
@@ -121,6 +121,9 @@ main = Main()
window.show_view(main) window.show_view(main)
# Make window visible after all setup is complete (helps prevent double window on Wayland)
window.set_visible(True)
logging.debug('Game started.') logging.debug('Game started.')
arcade.run() arcade.run()