4ce19f9
Description: Force X11 if wx GL library is loaded
4ce19f9
Author: Olly Betts <olly@survex.com>
4ce19f9
Bug: https://trac.wxwidgets.org/ticket/17702
4ce19f9
Bug-Debian: https://bugs.debian.org/900678
4ce19f9
Forwarded: no
4ce19f9
Last-Update: 2019-08-13
4ce19f9
4ce19f9
--- a/src/gtk/glcanvas.cpp
4ce19f9
+++ b/src/gtk/glcanvas.cpp
4ce19f9
@@ -19,6 +19,17 @@
4ce19f9
 #include <gdk/gdkx.h>
4ce19f9
 #include "wx/gtk/private/gtk2-compat.h"
4ce19f9
 
4ce19f9
+#if GTK_CHECK_VERSION(3,10,0)
4ce19f9
+// wxGTK's wxGLCanvas requires X11 currently, so tell GDK that so under
4ce19f9
+// Wayland the app is still run using X11.  We put this here so it's
4ce19f9
+// only run when the wx GL library is loaded (in a monolithic build this
4ce19f9
+// will always be active if wx's GL support is enabled).
4ce19f9
+struct ForceX11 {
4ce19f9
+    ForceX11() { gdk_set_allowed_backends("x11"); }
4ce19f9
+};
4ce19f9
+static ForceX11 forcex11;
4ce19f9
+#endif
4ce19f9
+
4ce19f9
 #if WXWIN_COMPATIBILITY_2_8
4ce19f9
 
4ce19f9
 //-----------------------------------------------------------------------------