From a4abdee49294678574b65a4e7011913b5e7de6a2 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 23 Feb 2023 19:23:10 -0500 Subject: [PATCH] Force X11 if wx GL library is loaded 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index 07de770..2462302 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -24,6 +24,17 @@ #include #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) -- 2.30.2