-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8538 from AvaloniaUI/feature/expose-gtk-thread-in…
…voke Introduced GtkInteropHelper.RunOnGlibThread, fixed demos # Conflicts: # samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs # samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs
- Loading branch information
1 parent
0b525bf
commit e975100
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
|
||
namespace Avalonia.X11.Interop; | ||
|
||
public class GtkInteropHelper | ||
{ | ||
public static async Task<T> RunOnGlibThread<T>(Func<T> cb) | ||
{ | ||
if (!await NativeDialogs.Gtk.StartGtk().ConfigureAwait(false)) | ||
throw new Win32Exception("Unable to initialize GTK"); | ||
return await NativeDialogs.Glib.RunOnGlibThread(cb).ConfigureAwait(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters