Description: Prevent a crash on XWayland
 Prevent the use of XWayland in Wayland environments, as it can lead to a crash when trying to render the game window.
 This setting forces the use of native Wayland if available, and fall back to X11 when not in a Wayland session.
 The crash can still be reproduced by exporting SDL_VIDEODRIVER=x11 prior to running the game on Wayland.
 See https://bugs.debian.org/1037045 for more details.
Author: Antoine Le Gonidec <debian@vv221.fr>
Forwarded: no
Last-Update: 2025-03-04
---
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -98,6 +98,14 @@
 	textdomain("blobAndConquer");
 	bindtextdomain("blobAndConquer", LOCALEDIR);
 
+	/*
+	 * Prevent the use of XWayland in Wayland environments, as it can lead to a crash when trying to render the game window.
+	 * This setting forces the use of native Wayland if available, and fall back to X11 when not in a Wayland session.
+	 * The crash can still be reproduced by exporting SDL_VIDEODRIVER=x11 prior to running the game on Wayland.
+	 * See https://bugs.debian.org/1037045 for more details.
+	 */
+	setenv("SDL_VIDEODRIVER", "wayland,x11", 0);
+
 	atexit(cleanup);
 	
 	game->saveSlot = -1;
