Force X11 if wx GL library is loaded
authorOlly Betts <olly@survex.com>
Fri, 24 Feb 2023 00:23:10 +0000 (19:23 -0500)
committerScott Talbert <swt@techie.net>
Fri, 24 Feb 2023 00:23:10 +0000 (19:23 -0500)
Bug: https://trac.wxwidgets.org/ticket/17702
Bug-Debian: https://bugs.debian.org/900678
Forwarded: no
Last-Update: 2022-11-28

Gbp-Pq: Name force-x11-for-wxgl.patch

src/gtk/glcanvas.cpp

index 07de770699d51139f98c67569fd496a84828a9fd..2462302f617f78050f08f8c6554c3f65c9b88195 100644 (file)
 #include <gdk/gdkx.h>
 #endif
 
+#if GTK_CHECK_VERSION(3,10,0)
+// wxGTK's wxGLCanvas requires X11 currently, so tell GDK that so under
+// Wayland the app is still run using X11.  We put this here so it's
+// only run when the wx GL library is loaded (in a monolithic build this
+// will always be active if wx's GL support is enabled).
+struct ForceX11 {
+    ForceX11() { gdk_set_allowed_backends("x11"); }
+};
+static ForceX11 forcex11;
+#endif
+
 #ifdef __WXGTK3__
 extern "C" {
 static gboolean draw(GtkWidget* widget, cairo_t* cr, wxGLCanvas* win)