From 3e710fe7c95513a5e905537f0c4ef6f9d229ecb4 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 14 Sep 2023 03:40:29 +0300 Subject: [PATCH] Wayland: add KICAD_WAYLAND_TRICKS env variable. --- libs/kiplatform/gtk/environment.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libs/kiplatform/gtk/environment.cpp b/libs/kiplatform/gtk/environment.cpp index ed8150bdf5..2b6ab873ab 100644 --- a/libs/kiplatform/gtk/environment.cpp +++ b/libs/kiplatform/gtk/environment.cpp @@ -39,16 +39,25 @@ void KIPLATFORM::ENV::Init() wxString gdkBackend; wxGetEnv( wxT( "GDK_BACKEND" ), &gdkBackend ); - if( gdkBackend == wxT( "broadway" ) ) + // Set KICAD_WAYLAND_TRICKS to develop for native Wayland. + if( wxGetEnv( wxT( "KICAD_WAYLAND_TRICKS" ), nullptr ) ) { - // Work around static setter in wx - gdk_set_allowed_backends( "broadway" ); + wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "wayland" ) ); + gdk_set_allowed_backends( "wayland" ); } - else if( gdkBackend != wxT( "wayland" ) ) + else { - // Force the use of X11 backend (or wayland-x11 compatibility layer). This is - // required until wxWidgets supports the Wayland compositors - wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "x11" ) ); + if( gdkBackend == wxT( "broadway" ) ) + { + // Work around static setter in wx + gdk_set_allowed_backends( "broadway" ); + } + else if( gdkBackend != wxT( "wayland" ) ) + { + // Force the use of X11 backend (or wayland-x11 compatibility layer). This is + // required until wxWidgets supports the Wayland compositors + wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "x11" ) ); + } } // Set GTK2-style input instead of xinput2. This disables touchscreen and smooth