From f91eb708f44871ac59ec16bd36301b27d2d985cb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Sat, 4 Jan 2025 20:23:44 +0100 Subject: [PATCH] Fallback if Xwayland was used but failed --- src/tauon/__main__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py index ce875c54f..701fbaf06 100755 --- a/src/tauon/__main__.py +++ b/src/tauon/__main__.py @@ -355,7 +355,22 @@ def transfer_args_and_exit() -> None: logging.error(f"Size 1: {logical_size[1]}") logging.error(f"Flags: {flags}") logging.error(f"SDL Error: {SDL_GetError()}") - sys.exit(1) + if str(SDL_GetError()) == "x11 not available": + x11_path = user_directory / "x11" + if x11_path.exists(): + logging.critical("Disabled Xwayland preference as X11 was not found - Known issue if on Flatpak - https://github.com/Taiko2k/Tauon/issues/1034") + x11_path.unlink() + os.environ["SDL_VIDEODRIVER"] = "wayland" + t_window = SDL_CreateWindow( + window_title, + o_x, o_y, + logical_size[0], logical_size[1], + flags) + if not t_window: + logging.error(f"Failed to create Wayland fallback window - SDL Error: {SDL_GetError()}") + sys.exit(1) + else: + sys.exit(1) if maximized: SDL_MaximizeWindow(t_window)