Don't set GDK_BACKEND=x11 when EGL is enabled in wx.

This commit is contained in:
Alex Shvartzkop 2023-09-18 10:12:06 +03:00 committed by dsa-t
parent 06463fd35a
commit c49b19b0ce
1 changed files with 5 additions and 32 deletions

View File

@ -34,41 +34,14 @@ void KIPLATFORM::ENV::Init()
wxString wm;
if( wxGetEnv( wxT( "XDG_CURRENT_DESKTOP" ), &wm ) && wm.CmpNoCase( wxT( "Unity" ) ) == 0 )
wxSetEnv ( wxT("UBUNTU_MENUPROXY" ), wxT( "0" ) );
wxSetEnv( wxT( "UBUNTU_MENUPROXY" ), wxT( "0" ) );
wxString gdkBackend;
wxGetEnv( wxT( "GDK_BACKEND" ), &gdkBackend );
#ifdef KICAD_WAYLAND
bool waylandTricks = true;
#else
bool waylandTricks = false;
#if !wxUSE_GLCANVAS_EGL
// 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" ) );
#endif
if( wxGetEnv( wxT( "KICAD_WAYLAND_TRICKS" ), nullptr ) )
waylandTricks = true;
// Set KICAD_WAYLAND_TRICKS to develop for native Wayland.
if( waylandTricks )
{
wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "wayland" ) );
gdk_set_allowed_backends( "wayland" );
}
else
{
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
// scrolling. It's needed to ensure that we are not getting multiple mouse scroll
// events.