Wayland: add KICAD_WAYLAND_TRICKS env variable.

This commit is contained in:
Alex 2023-09-14 03:40:29 +03:00
parent d5801a48d3
commit 3e710fe7c9
1 changed files with 16 additions and 7 deletions

View File

@ -39,16 +39,25 @@ void KIPLATFORM::ENV::Init()
wxString gdkBackend; wxString gdkBackend;
wxGetEnv( wxT( "GDK_BACKEND" ), &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 wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "wayland" ) );
gdk_set_allowed_backends( "broadway" ); gdk_set_allowed_backends( "wayland" );
} }
else if( gdkBackend != wxT( "wayland" ) ) else
{ {
// Force the use of X11 backend (or wayland-x11 compatibility layer). This is if( gdkBackend == wxT( "broadway" ) )
// required until wxWidgets supports the Wayland compositors {
wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "x11" ) ); // 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 // Set GTK2-style input instead of xinput2. This disables touchscreen and smooth