diff --git a/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs b/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs index 2cf893346f..b687d9d447 100644 --- a/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs +++ b/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs @@ -35,6 +35,9 @@ namespace Avalonia.Gtk3 X11.XInitThreads(); }catch{} Resolver.Resolve(); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + using (var backends = new Utf8Buffer("x11")) + Native.GdkSetAllowedBackends?.Invoke(backends); Native.GtkInit(0, IntPtr.Zero); var disp = Native.GdkGetDefaultDisplay(); DisplayClassName = diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs index 3b9007786d..3e945798d4 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs @@ -48,10 +48,13 @@ namespace Avalonia.Gtk3.Interop public delegate void gtk_main_iteration(); [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] - public delegate GtkWindow gtk_window_new(GtkWindowType windowType); - + public delegate GtkWindow gtk_window_new(GtkWindowType windowType); + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] public delegate IntPtr gtk_init(int argc, IntPtr argv); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk, optional: true)] + public delegate IntPtr gdk_set_allowed_backends (Utf8Buffer backends); [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] public delegate void gtk_window_present(GtkWindow gtkWindow); @@ -393,6 +396,7 @@ namespace Avalonia.Gtk3.Interop public static D.gtk_window_new GtkWindowNew; public static D.gtk_window_set_icon GtkWindowSetIcon; public static D.gtk_window_set_modal GtkWindowSetModal; + public static D.gdk_set_allowed_backends GdkSetAllowedBackends; public static D.gtk_init GtkInit; public static D.gtk_window_present GtkWindowPresent; public static D.gtk_widget_hide GtkWidgetHide;