From 7fb112727a40b9b215cc26b81d62f34ea5d0a08e Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Mon, 26 Oct 2020 11:44:13 +0100 Subject: [PATCH 01/25] Prevent double removal of timeout sources See https://github.com/GLibSharp/GtkSharp/pull/49 --- Source/Libs/GLibSharp/Idle.cs | 2 +- Source/Libs/GLibSharp/Timeout.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Libs/GLibSharp/Idle.cs b/Source/Libs/GLibSharp/Idle.cs index bbdde15f4..db65c5205 100644 --- a/Source/Libs/GLibSharp/Idle.cs +++ b/Source/Libs/GLibSharp/Idle.cs @@ -54,7 +54,7 @@ namespace GLib { { lock (this) { - Remove (); + Dispose(); } } return cont; diff --git a/Source/Libs/GLibSharp/Timeout.cs b/Source/Libs/GLibSharp/Timeout.cs index 8e17e464d..4f3ca34b3 100644 --- a/Source/Libs/GLibSharp/Timeout.cs +++ b/Source/Libs/GLibSharp/Timeout.cs @@ -52,7 +52,7 @@ namespace GLib { { lock (this) { - Remove (); + Dispose(); } } return cont; From c3364fd338d7642b0138770ad8c5b6e5e4ed6ae4 Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Thu, 5 Nov 2020 12:33:43 +0100 Subject: [PATCH 02/25] Fix MessageDialog effectively creating an additional Dialog due to wrong base call --- Source/Libs/GtkSharp/MessageDialog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Libs/GtkSharp/MessageDialog.cs b/Source/Libs/GtkSharp/MessageDialog.cs index 5034aa5ad..f3cce9270 100644 --- a/Source/Libs/GtkSharp/MessageDialog.cs +++ b/Source/Libs/GtkSharp/MessageDialog.cs @@ -26,7 +26,7 @@ namespace Gtk { delegate IntPtr d_gtk_message_dialog_new_with_markup(IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args); static d_gtk_message_dialog_new_with_markup gtk_message_dialog_new_with_markup = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_message_dialog_new_with_markup")); - public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args) + public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args) : base (IntPtr.Zero) { IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero; From 470ce6cff70e9b4248e9b105c9c060eeb6a37ae2 Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Thu, 19 Nov 2020 16:22:47 +0100 Subject: [PATCH 03/25] Invoke Destroy in Dispose if the Widget IsToplevel and it is not already destroyed If the Widget is a toplevel then we have not ref'ed the Object, so ref before destroying it, and let the freeing of the ToggleRef undo the ref. --- Source/Libs/GtkSharp/Widget.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Source/Libs/GtkSharp/Widget.cs b/Source/Libs/GtkSharp/Widget.cs index 845495fba..78c74abd0 100644 --- a/Source/Libs/GtkSharp/Widget.cs +++ b/Source/Libs/GtkSharp/Widget.cs @@ -370,6 +370,7 @@ namespace Gtk { Gtk.Widget widget = o as Gtk.Widget; if (widget == null) return; + widget.OnDestroyed (); } @@ -387,20 +388,41 @@ namespace Gtk { base.CreateNativeObject (names, vals); } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_g_object_ref(IntPtr raw); + static d_g_object_ref g_object_ref = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_ref")); + + private bool destroyed; protected override void Dispose (bool disposing) { if (Handle == IntPtr.Zero) return; + + if (disposing && !destroyed && IsToplevel) + { + //If this is a TopLevel widget, then we do not hold a ref, only a toggle ref. + //Freeing our toggle ref expects a normal ref to exist, and therefore does not check if the object still exists. + //Take a ref here and let our toggle ref unref it. + g_object_ref (Handle); + gtk_widget_destroy (Handle); + destroyed = true; + } + InternalDestroyed -= NativeDestroyHandler; + base.Dispose (disposing); } - protected override IntPtr Raw { + protected override IntPtr Raw { get { return base.Raw; } set { + if (Handle == value) + return; + base.Raw = value; + if (value != IntPtr.Zero) InternalDestroyed += NativeDestroyHandler; } @@ -409,11 +431,18 @@ namespace Gtk { delegate void d_gtk_widget_destroy(IntPtr raw); static d_gtk_widget_destroy gtk_widget_destroy = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_widget_destroy")); + public virtual void Destroy () { if (Handle == IntPtr.Zero) return; + + if (destroyed) + return; + gtk_widget_destroy (Handle); + destroyed = true; + InternalDestroyed -= NativeDestroyHandler; } } From 06b88bdbc5ceb7abe4d9185a30cc474bbcd3ec74 Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Thu, 19 Nov 2020 16:41:06 +0100 Subject: [PATCH 04/25] Queue freeing of signals on the main-thread instead of on the Finalizer thread. --- Source/Libs/GLibSharp/Object.cs | 62 ++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/Source/Libs/GLibSharp/Object.cs b/Source/Libs/GLibSharp/Object.cs index 3ab7f12f1..833b8e513 100644 --- a/Source/Libs/GLibSharp/Object.cs +++ b/Source/Libs/GLibSharp/Object.cs @@ -33,7 +33,7 @@ namespace GLib { IntPtr handle; ToggleRef tref; - bool disposed = false; + bool disposed; static uint idx = 1; static Dictionary Objects = new Dictionary(); static Dictionary> PropertiesToSet = new Dictionary>(); @@ -41,7 +41,7 @@ namespace GLib { ~Object () { if (WarnOnFinalize) - Console.Error.WriteLine ("Unexpected finalization of " + GetType() + " instance. Consider calling Dispose."); + Console.Error.WriteLine ("Unexpected finalization of " + GetType() + " instance. Consider calling Dispose. (" + handle.ToInt64 () + ")"); Dispose (false); } @@ -51,9 +51,10 @@ namespace GLib { if (disposed) return; + GC.SuppressFinalize (this); + Dispose (true); disposed = true; - GC.SuppressFinalize (this); } protected virtual void Dispose (bool disposing) @@ -70,19 +71,25 @@ namespace GLib { return; if (disposing) - tref.Dispose (); - else - tref.QueueUnref (); - - // Free all internal signals, else the garbage collector is not - // able to free the object. - if (signals != null) { - foreach (var sig in signals.Keys) - signals[sig].Free (); + tref.Dispose (); + + if (signals != null) + { + foreach (var sig in signals.Keys) + signals[sig].Free (); + } + } + else + { + if (signals != null) + QueueSignalFree (); + + tref.QueueUnref (); } signals = null; + disposed = true; } public static bool WarnOnFinalize { get; set; } @@ -807,6 +814,9 @@ namespace GLib { GLib.Marshaller.Free (native_name); } + public static List PendingSignalFrees = new List (); + static bool idle_queued; + Dictionary signals; Dictionary Signals { get { @@ -853,6 +863,34 @@ namespace GLib { sig.RemoveDelegate (handler); } + public void QueueSignalFree () + { + lock (PendingSignalFrees) { + PendingSignalFrees.AddRange (signals.Values); + if (!idle_queued){ + Timeout.Add (50, new TimeoutHandler (PerformQueuedSignalFrees)); + idle_queued = true; + } + } + } + + static bool PerformQueuedSignalFrees () + { + Signal[] qsignals; + + lock (PendingSignalFrees){ + qsignals = new Signal[PendingSignalFrees.Count]; + PendingSignalFrees.CopyTo (qsignals, 0); + PendingSignalFrees.Clear (); + idle_queued = false; + } + + foreach (Signal s in qsignals) + s.Free (); + + return false; + } + protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb) { Signal.OverrideDefaultHandler (gtype, name, cb); From 41d6f0bf284977e39519eb735ac5ca2e2bbf2bec Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Thu, 19 Nov 2020 16:48:29 +0100 Subject: [PATCH 05/25] Queue freeing of GCHandles instead of freeing them immidiately --- Source/Libs/GLibSharp/ToggleRef.cs | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Source/Libs/GLibSharp/ToggleRef.cs b/Source/Libs/GLibSharp/ToggleRef.cs index 20517ac99..432257f69 100644 --- a/Source/Libs/GLibSharp/ToggleRef.cs +++ b/Source/Libs/GLibSharp/ToggleRef.cs @@ -71,8 +71,12 @@ namespace GLib { g_object_unref (handle); else g_object_remove_toggle_ref (handle, ToggleNotifyCallback, (IntPtr) gch); + reference = null; - gch.Free (); + + QueueGCHandleFree (); + + handle = IntPtr.Zero; } internal void Harden () @@ -97,7 +101,8 @@ namespace GLib { reference = new WeakReference (reference); else if (!is_last_ref && reference is WeakReference) { WeakReference weak = reference as WeakReference; - reference = weak.Target; + if (weak.IsAlive) + reference = weak.Target; } } @@ -124,6 +129,37 @@ namespace GLib { } } + static List PendingGCHandleFrees = new List (); + static bool gc_idle_queued; + + public void QueueGCHandleFree () + { + lock (PendingGCHandleFrees) { + PendingGCHandleFrees.Add (gch); + if (!gc_idle_queued){ + Timeout.Add (50, new TimeoutHandler (PerformGCHandleFrees)); + gc_idle_queued = true; + } + } + } + + static bool PerformGCHandleFrees () + { + GCHandle[] handles; + + lock (PendingGCHandleFrees){ + handles = new GCHandle [PendingGCHandleFrees.Count]; + PendingGCHandleFrees.CopyTo (handles, 0); + PendingGCHandleFrees.Clear (); + gc_idle_queued = false; + } + + foreach (GCHandle r in handles) + r.Free (); + + return false; + } + static List PendingDestroys = new List (); static bool idle_queued; From 0daa9853166a886005a6219862da5a4c9ce1c296 Mon Sep 17 00:00:00 2001 From: Mads Kruse Johnsen Date: Mon, 25 Jan 2021 12:29:04 +0100 Subject: [PATCH 06/25] Add method GetRawOwnedObject to Builder. This method performs a GetRawObject, but also increases the refcount. This is (at least) needed in cases where you wish to have a class inherting a widget, and use a builder in the constructor : base (builder.GetRawObject("name")) Because no ref is taken the eventual freeing of the builder will cause the our object (this) to have a refcount 0. This is an issue since the freeing of our ToggleRef (which should happen later) performs an unref. --- Source/Libs/GtkSharp/Builder.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Libs/GtkSharp/Builder.cs b/Source/Libs/GtkSharp/Builder.cs index c09fff6cd..9e6234d5c 100644 --- a/Source/Libs/GtkSharp/Builder.cs +++ b/Source/Libs/GtkSharp/Builder.cs @@ -151,6 +151,16 @@ namespace Gtk { GLib.Marshaller.Free (native_name); return raw_ret; } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_g_object_ref(IntPtr raw); + static d_g_object_ref g_object_ref = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_ref")); + + public IntPtr GetRawOwnedObject(string name) { + IntPtr raw_ret = GetRawObject (name); + g_object_ref (raw_ret); + return raw_ret; + } public Builder (System.IO.Stream s) : this (s, null) { From 92752a2bf668ec40cd0bc3324dc3635a65def147 Mon Sep 17 00:00:00 2001 From: Harry Date: Sat, 27 Feb 2021 16:16:10 +0100 Subject: [PATCH 07/25] Revert "Don't add reference to PixbufHandle" This reverts commit b831ee8ca161c168406d2697407f93df235b6e6e. --- Source/Libs/GdkSharp/PixbufLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Libs/GdkSharp/PixbufLoader.cs b/Source/Libs/GdkSharp/PixbufLoader.cs index 01d36ff35..faf2899e4 100644 --- a/Source/Libs/GdkSharp/PixbufLoader.cs +++ b/Source/Libs/GdkSharp/PixbufLoader.cs @@ -33,7 +33,7 @@ namespace Gdk { internal IntPtr PixbufHandle { get { - return gdk_pixbuf_loader_get_pixbuf (Handle); + return g_object_ref (gdk_pixbuf_loader_get_pixbuf (Handle)); } } From 7f5e81cf47122f7b90760949f90eb88f236d04de Mon Sep 17 00:00:00 2001 From: Harry Date: Sun, 7 Mar 2021 12:31:19 +0100 Subject: [PATCH 08/25] Bump up dependencies (#221) --- Source/Libs/GtkSharp/GtkSharp.targets | 4 +- Source/Libs/Shared/GLibrary.cs | 2 +- Source/Samples/Samples.csproj | 6 +- .../Samples/Sections/Widgets/ImageSection.cs | 22 +-- .../.template.config/template.json | 4 +- .../GtkNamespace.csproj | 2 +- .../.template.config/template.json | 4 +- .../GtkNamespace.fsproj | 2 +- .../.template.config/template.json | 4 +- .../GtkNamespace.vbproj | 2 +- Source/Tools/GapiCodegen/GapiCodegen.csproj | 2 +- Source/Tools/GapiFixup/GapiFixup.csproj | 2 +- azure-pipelines.yml | 12 +- build.cake | 43 +--- build.ps1 | 184 +++++++++++++----- build.sh | 6 +- tools/packages.config | 2 +- 17 files changed, 164 insertions(+), 139 deletions(-) diff --git a/Source/Libs/GtkSharp/GtkSharp.targets b/Source/Libs/GtkSharp/GtkSharp.targets index 584761cb3..73d013aca 100644 --- a/Source/Libs/GtkSharp/GtkSharp.targets +++ b/Source/Libs/GtkSharp/GtkSharp.targets @@ -1,8 +1,8 @@ - https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.20.zip - $(LOCALAPPDATA)\Gtk\3.24.20 + https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.24.zip + $(LOCALAPPDATA)\Gtk\3.24.24 diff --git a/Source/Libs/Shared/GLibrary.cs b/Source/Libs/Shared/GLibrary.cs index e02b21398..62f810f55 100644 --- a/Source/Libs/Shared/GLibrary.cs +++ b/Source/Libs/Shared/GLibrary.cs @@ -42,7 +42,7 @@ class GLibrary if (ret == IntPtr.Zero) { - SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.20")); + SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.24")); ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]); } } diff --git a/Source/Samples/Samples.csproj b/Source/Samples/Samples.csproj index 5c9986a95..a9a1f5291 100644 --- a/Source/Samples/Samples.csproj +++ b/Source/Samples/Samples.csproj @@ -1,7 +1,7 @@ WinExe - netcoreapp3.1 + net5.0 false ..\..\BuildOutput\Samples @@ -10,7 +10,9 @@ %(Filename)%(Extension) - + + Testpic + diff --git a/Source/Samples/Sections/Widgets/ImageSection.cs b/Source/Samples/Sections/Widgets/ImageSection.cs index 8cb2d01c7..d54da9425 100644 --- a/Source/Samples/Sections/Widgets/ImageSection.cs +++ b/Source/Samples/Sections/Widgets/ImageSection.cs @@ -21,29 +21,9 @@ namespace Samples public (string, Widget) CreateContainer() { - Stream GetResourceStream(Assembly assembly, string name) - { - var resources = assembly.GetManifestResourceNames(); - var resourceName = resources.SingleOrDefault(str => str == name); - - // try harder: - if (resourceName == default) { - resourceName = resources.SingleOrDefault(str => str.EndsWith(name)); - } - - if (resourceName == default) - return default; - var stream = assembly.GetManifestResourceStream(resourceName); - return stream; - } - Pixbuf image = default; - using (var stream = GetResourceStream(typeof(ImageSection).Assembly, "Testpic.png")) { - image = new Pixbuf(stream); - } - + var image = new Pixbuf(typeof(ImageSection).Assembly, "Testpic"); var container = new ImageBox(image); - return ($"{nameof(ImageBox)}:", container); } } diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.json index 9f4a98439..214691dda 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.json +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.json @@ -18,8 +18,8 @@ "symbols": { "targetframework": { "type": "parameter", - "defaultValue": "netcoreapp2.0", - "replaces": "netcoreapp2.0" + "defaultValue": "net5.0", + "replaces": "net5.0" } }, "primaryOutputs": [ diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj index 68d9201a0..841977aa2 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp3.1 + net5.0 diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json index dd7d589a9..019d38558 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json @@ -18,8 +18,8 @@ "symbols": { "targetframework": { "type": "parameter", - "defaultValue": "netcoreapp2.0", - "replaces": "netcoreapp2.0" + "defaultValue": "net5.0", + "replaces": "net5.0" } }, "primaryOutputs": [ diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj index eaba991e2..b4506fadf 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.json b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.json index bee173d46..51f775308 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.json +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.json @@ -18,8 +18,8 @@ "symbols": { "targetframework": { "type": "parameter", - "defaultValue": "netcoreapp2.0", - "replaces": "netcoreapp2.0" + "defaultValue": "net5.0", + "replaces": "net5.0" } }, "primaryOutputs": [ diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj index 68d9201a0..841977aa2 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj @@ -2,7 +2,7 @@ WinExe - netcoreapp3.1 + net5.0 diff --git a/Source/Tools/GapiCodegen/GapiCodegen.csproj b/Source/Tools/GapiCodegen/GapiCodegen.csproj index 75abe931c..653fe5d27 100644 --- a/Source/Tools/GapiCodegen/GapiCodegen.csproj +++ b/Source/Tools/GapiCodegen/GapiCodegen.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + net5.0 ..\..\..\BuildOutput\Tools false diff --git a/Source/Tools/GapiFixup/GapiFixup.csproj b/Source/Tools/GapiFixup/GapiFixup.csproj index bc0b29609..713576357 100644 --- a/Source/Tools/GapiFixup/GapiFixup.csproj +++ b/Source/Tools/GapiFixup/GapiFixup.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp2.0 + net5.0 ..\..\..\BuildOutput\Tools false diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 78b98a171..54555b8bd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,5 @@ variables: - versionbase: 3.22.25 + versionbase: 3.24.24 increment: $[counter(variables['versionbase'], 1)] version: $(versionbase).$(increment) @@ -16,9 +16,6 @@ steps: - script: echo "##vso[build.updatebuildnumber]$(version)" displayName: 'Set Build Number' - - script: sudo apt install -y monodevelop - displayName: 'Install MonoDevelop' - - script: ./build.sh --BuildTarget=FullBuild --BuildVersion=$(version) displayName: 'CAKE Script' @@ -42,10 +39,3 @@ steps: pathtoPublish: BuildOutput/Samples artifactName: Samples publishLocation: container - - - task: PublishBuildArtifacts@1 - displayName: Publish MonoDevelop Addin - inputs: - pathtoPublish: BuildOutput/Addins/MonoDevelop/MonoDevelop.GtkSharp.Addin_$(version).mpack - artifactName: MonoDevelop Addin - publishLocation: container \ No newline at end of file diff --git a/build.cake b/build.cake index 4b9bb2f60..34a6352b4 100644 --- a/build.cake +++ b/build.cake @@ -1,12 +1,12 @@ #load CakeScripts\GAssembly.cake #load CakeScripts\Settings.cake -#addin "Cake.FileHelpers&version=3.2.0" -#addin "Cake.Incubator&version=5.0.1" +#addin "Cake.FileHelpers&version=4.0.0" +#addin "Cake.Incubator&version=6.0.0" // VARS Settings.Cake = Context; -Settings.Version = Argument("BuildVersion", "3.22.24.30"); +Settings.Version = Argument("BuildVersion", "3.24.24.1"); Settings.BuildTarget = Argument("BuildTarget", "Default"); Settings.Assembly = Argument("Assembly", ""); var configuration = Argument("Configuration", "Release"); @@ -63,7 +63,10 @@ Task("FullClean") .IsDependentOn("Clean") .Does(() => { - DeleteDirectory("BuildOutput", true); + DeleteDirectory("BuildOutput", new DeleteDirectorySettings { + Recursive = true, + Force = true + }); }); Task("Build") @@ -136,35 +139,6 @@ Task("PackageTemplates") NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings); }); -Task("PackageAddin") - .IsDependentOn("PackageTemplates") - .Does(() => -{ - // Copy the current version nuget templates - CopyFile( - "BuildOutput/NugetPackages/GtkSharp.Template.CSharp." + Settings.Version + ".nupkg", - "Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.CSharp.nupkg" - ); - CopyFile( - "BuildOutput/NugetPackages/GtkSharp.Template.FSharp." + Settings.Version + ".nupkg", - "Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.FSharp.nupkg" - ); - - // Generate version code info - var versionline = "[assembly: Mono.Addins.Addin(\"MonoDevelop.GtkSharp.Addin\", Version = \"" + Settings.Version + "\")]"; - FileWriteText("Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.Version.cs", versionline); - - // Build MonoDevelop addin - var msbuildsettings = new MSBuildSettings - { - Configuration = configuration, - }; - msbuildsettings = msbuildsettings.WithProperty("Version", Settings.Version); - msbuildsettings = msbuildsettings.WithTarget("PackageAddin"); - - MSBuild("Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln", msbuildsettings); -}); - // TASK TARGETS Task("Default") @@ -172,8 +146,7 @@ Task("Default") Task("FullBuild") .IsDependentOn("PackageNuGet") - .IsDependentOn("PackageTemplates") - .IsDependentOn("PackageAddin"); + .IsDependentOn("PackageTemplates"); // EXECUTION diff --git a/build.ps1 b/build.ps1 index ad6e59947..2ce2dd795 100644 --- a/build.ps1 +++ b/build.ps1 @@ -5,14 +5,11 @@ ########################################################################## <# - .SYNOPSIS This is a Powershell script to bootstrap a Cake build. - .DESCRIPTION This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) and execute your Cake build script with the parameters you provide. - .PARAMETER Script The build script to execute. .PARAMETER Target @@ -21,40 +18,55 @@ The build script target to run. The build configuration to use. .PARAMETER Verbosity Specifies the amount of information to be displayed. -.PARAMETER Experimental -Tells Cake to use the latest Roslyn release. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER Mono -Tells Cake to use the Mono scripting engine. +.PARAMETER ShowDescription +Shows description about tasks. +.PARAMETER DryRun +Performs a dry run. .PARAMETER SkipToolPackageRestore Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. - .LINK https://cakebuild.net - #> [CmdletBinding()] Param( - [string]$Script = "build.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", + [string]$Script, + [string]$Target, + [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$Experimental, - [Alias("DryRun","Noop")] - [switch]$WhatIf, - [switch]$Mono, + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) +# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x +if (-not (Test-Path variable:global:IsCoreCLR)) { + $IsCoreCLR = $false +} + +# Attempt to set highest encryption available for SecurityProtocol. +# PowerShell will not set this by default (until maybe .NET 4.6.x). This +# will typically produce a message for PowerShell v2 (just an info +# message though) +try { + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that. + if (-not $IsCoreCLR) { + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 + } + } catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' + } + [Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null function MD5HashFile([string] $filePath) { @@ -80,49 +92,52 @@ function MD5HashFile([string] $filePath) } } +function GetProxyEnabledWebClient +{ + $wc = New-Object System.Net.WebClient + $proxy = [System.Net.WebRequest]::GetSystemWebProxy() + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $wc.Proxy = $proxy + return $wc +} + Write-Host "Preparing to run build script..." if(!$PSScriptRoot){ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } +if(!$Script){ + $Script = Join-Path $PSScriptRoot "build.cake" +} $TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" +$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" $CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" $NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" $PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" $PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" +$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" +$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" -# Should we use mono? -$UseMono = ""; -if($Mono.IsPresent) { - Write-Verbose -Message "Using the Mono based scripting engine." - $UseMono = "-mono" -} - -# Should we use the new Roslyn? -$UseExperimental = ""; -if($Experimental.IsPresent -and !($Mono.IsPresent)) { - Write-Verbose -Message "Using experimental version of Roslyn." - $UseExperimental = "-experimental" -} - -# Is this a dry run? -$UseDryRun = ""; -if($WhatIf.IsPresent) { - $UseDryRun = "-dryrun" -} +$env:CAKE_PATHS_TOOLS = $TOOLS_DIR +$env:CAKE_PATHS_ADDINS = $ADDINS_DIR +$env:CAKE_PATHS_MODULES = $MODULES_DIR # Make sure tools folder exists if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null + New-Item -Path $TOOLS_DIR -Type Directory | Out-Null } # Make sure that packages.config exist. if (!(Test-Path $PACKAGES_CONFIG)) { Write-Verbose -Message "Downloading packages.config..." - try { (New-Object System.Net.WebClient).DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) + } catch { Throw "Could not download packages.config." } } @@ -142,14 +157,26 @@ if (!(Test-Path $NUGET_EXE)) { if (!(Test-Path $NUGET_EXE)) { Write-Verbose -Message "Downloading NuGet.exe..." try { - (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + $wc = GetProxyEnabledWebClient + $wc.DownloadFile($NUGET_URL, $NUGET_EXE) } catch { Throw "Could not download NuGet.exe." } } +# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x +if (-not (Test-Path variable:global:ismacos)) { + $IsLinux = $false + $IsMacOS = $false +} + # Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$NUGET_EXE`"" +} else { + "`"$NUGET_EXE`"" +} # Restore tools from NuGet? if(-Not $SkipToolPackageRestore.IsPresent) { @@ -157,24 +184,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) { Set-Location $TOOLS_DIR # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { Write-Verbose -Message "Missing or changed package.config hash..." - Remove-Item * -Recurse -Exclude packages.config,nuget.exe + Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | + Remove-Item -Recurse -Force } Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." + Throw "An error occurred while restoring NuGet tools." } else { $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore addins from NuGet +if (Test-Path $ADDINS_PACKAGES_CONFIG) { + Push-Location + Set-Location $ADDINS_DIR + + Write-Verbose -Message "Restoring addins from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet addins." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore modules from NuGet +if (Test-Path $MODULES_PACKAGES_CONFIG) { + Push-Location + Set-Location $MODULES_DIR + + Write-Verbose -Message "Restoring modules from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet modules." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + Pop-Location } @@ -183,7 +247,23 @@ if (!(Test-Path $CAKE_EXE)) { Throw "Could not find Cake.exe at $CAKE_EXE" } +$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$CAKE_EXE`"" +} else { + "`"$CAKE_EXE`"" +} + + # Build an array (not a string) of Cake arguments to be joined later +$cakeArguments = @() +if ($Script) { $cakeArguments += "`"$Script`"" } +if ($Target) { $cakeArguments += "--target=`"$Target`"" } +if ($Configuration) { $cakeArguments += "--configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "--verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "--showdescription" } +if ($DryRun) { $cakeArguments += "--dryrun" } +$cakeArguments += $ScriptArgs + # Start Cake Write-Host "Running build script..." -Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" -exit $LASTEXITCODE \ No newline at end of file +Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")" +exit $LASTEXITCODE diff --git a/build.sh b/build.sh index 0e42a0a1e..14392d4ed 100755 --- a/build.sh +++ b/build.sh @@ -56,7 +56,7 @@ if [ ! -f "$TOOLS_DIR/packages.config" ]; then echo "Downloading packages.config..." curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages if [ $? -ne 0 ]; then - echo "An error occured while downloading packages.config." + echo "An error occurred while downloading packages.config." exit 1 fi fi @@ -66,7 +66,7 @@ if [ ! -f "$NUGET_EXE" ]; then echo "Downloading NuGet..." curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe if [ $? -ne 0 ]; then - echo "An error occured while downloading nuget.exe." + echo "An error occurred while downloading nuget.exe." exit 1 fi fi @@ -97,5 +97,5 @@ fi if $SHOW_VERSION; then exec mono "$CAKE_EXE" -version else - exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" + exec mono "$CAKE_EXE" $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" fi \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config index cedcc6ab5..2a0374690 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + From c4da08592538fc3e9a1b05a95afeac5ee582adc5 Mon Sep 17 00:00:00 2001 From: lytico Date: Thu, 18 Mar 2021 19:01:48 +0100 Subject: [PATCH 09/25] add test for https://github.com/GtkSharp/GtkSharp/issues/226 --- .../Sections/Miscellaneous/PixbufSection.cs | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Source/Samples/Sections/Miscellaneous/PixbufSection.cs diff --git a/Source/Samples/Sections/Miscellaneous/PixbufSection.cs b/Source/Samples/Sections/Miscellaneous/PixbufSection.cs new file mode 100644 index 000000000..bbd431c6f --- /dev/null +++ b/Source/Samples/Sections/Miscellaneous/PixbufSection.cs @@ -0,0 +1,93 @@ +using System; +using System.Threading; +using Gdk; +using Gtk; + +namespace Samples +{ + + [Section (ContentType = typeof(PixbufDemo), Category = Category.Miscellaneous)] + class PixbufSection : ListSection + { + + public PixbufSection () + { + AddItem ($"Press button to run / stop {nameof(PixbufDemo)} :", new PixbufDemo ("Press me")); + } + + } + + class PixbufDemo : Button + { + + public PixbufDemo (string text) : base (text) { } + + private bool running = false; + + public void DispatchPendingEvents () + { + // The loop is limited to 1000 iterations as a workaround for an issue that some users + // have experienced. Sometimes EventsPending starts return 'true' for all iterations, + // causing the loop to never end. + + int n = 1000; + Gdk.Threads.Enter (); + + while (Gtk.Application.EventsPending () && --n > 0) { + Gtk.Application.RunIteration (false); + } + + Gdk.Threads.Leave (); + } + + protected override void OnPressed () + { + base.OnPressed (); + var count = 0; + + if (running) { + running = false; + + return; + } + + var startmem = GC.GetTotalMemory (true); + var testfile = "Textpic.png"; + + using (var writeTestFile = new Pixbuf (typeof(ImageSection).Assembly, "Testpic")) { + writeTestFile.Save (testfile, "png"); + } + + using (var heatup = new Pixbuf (testfile)) { + ApplicationOutput.WriteLine ($"{nameof(heatup)}.{nameof(Pixbuf.ByteLength)}\t{heatup.ByteLength:N0}"); + } + + startmem = GC.GetTotalMemory (true); + ApplicationOutput.WriteLine ($"{nameof(GC.GetTotalMemory)} at start: {startmem:N}"); + running = true; + + var memAllocated = 0UL; + + while (running) { + + using (var source = new Pixbuf (typeof(ImageSection).Assembly, "Testpic")) { + memAllocated += source.ByteLength; + count++; + } + + DispatchPendingEvents (); + + if (!running) + break; + + } + + var endmem = GC.GetTotalMemory (true); + ApplicationOutput.WriteLine ($"Leak:\t{(endmem - startmem):N0}\t{nameof(memAllocated)}"); + ApplicationOutput.WriteLine ($"{nameof(GC.GetTotalMemory)} at start: {startmem:N0}\tat end: {endmem:N0}\t{nameof(Pixbuf)} created: {count}"); + + } + + } + +} \ No newline at end of file From b6b21839547f3f1e56ea19c523e8a64cfef9f90b Mon Sep 17 00:00:00 2001 From: lytico Date: Thu, 18 Mar 2021 21:04:37 +0100 Subject: [PATCH 10/25] PixbufSection.cs: ajdust writetestfile to work on windows --- Source/Samples/Sections/Miscellaneous/PixbufSection.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Samples/Sections/Miscellaneous/PixbufSection.cs b/Source/Samples/Sections/Miscellaneous/PixbufSection.cs index bbd431c6f..db74f93ea 100644 --- a/Source/Samples/Sections/Miscellaneous/PixbufSection.cs +++ b/Source/Samples/Sections/Miscellaneous/PixbufSection.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Threading; using Gdk; using Gtk; @@ -54,8 +55,9 @@ namespace Samples var startmem = GC.GetTotalMemory (true); var testfile = "Textpic.png"; - using (var writeTestFile = new Pixbuf (typeof(ImageSection).Assembly, "Testpic")) { - writeTestFile.Save (testfile, "png"); + using var teststream = typeof(ImageSection).Assembly.GetManifestResourceStream("Testpic"); + using (var writeTestFile = new FileStream(testfile, FileMode.Create)) { + teststream.CopyTo(writeTestFile); } using (var heatup = new Pixbuf (testfile)) { From cd0468edc8dfcccd15f3a6ea069b716bb4e9535f Mon Sep 17 00:00:00 2001 From: dmg Date: Fri, 19 Mar 2021 18:24:35 +0300 Subject: [PATCH 11/25] Fixed some APIs according to GTK docs --- Source/Libs/GioSharp/GioSharp.metadata | 6 ++++++ Source/Libs/GtkSharp/GtkSharp.metadata | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Libs/GioSharp/GioSharp.metadata b/Source/Libs/GioSharp/GioSharp.metadata index d3c96ce4d..a7d1b8cbc 100644 --- a/Source/Libs/GioSharp/GioSharp.metadata +++ b/Source/Libs/GioSharp/GioSharp.metadata @@ -54,6 +54,12 @@ EmitActionEnabledChanged EmitActionRemoved EmitActionStateChanged + true + true + true + true + true + true 1 GetCanRemoveSupportsType 1 diff --git a/Source/Libs/GtkSharp/GtkSharp.metadata b/Source/Libs/GtkSharp/GtkSharp.metadata index 505b50580..4119010be 100644 --- a/Source/Libs/GtkSharp/GtkSharp.metadata +++ b/Source/Libs/GtkSharp/GtkSharp.metadata @@ -364,6 +364,8 @@ 1 + out + out Activated ClipboardCopied ClipboardCut @@ -1006,7 +1008,7 @@ - - true - true + + true + true From 6045b816db39b5eb137329419abcceb4390381df Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 19 Mar 2021 18:16:08 +0100 Subject: [PATCH 12/25] Update templates to use GetRawOwnedObject --- .../content/GtkSharp.Application.CSharp/MainWindow.cs | 2 +- .../content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs | 2 +- .../content/GtkSharp.Widget.CSharp/Gtk_Widget.cs | 2 +- .../content/GtkSharp.Window.CSharp/Gtk_Window.cs | 2 +- .../content/GtkSharp.Application.FSharp/MainWindow.fs | 2 +- .../content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs | 2 +- .../content/GtkSharp.Widget.FSharp/Gtk_Widget.fs | 2 +- .../content/GtkSharp.Window.FSharp/Gtk_Window.fs | 2 +- .../content/GtkSharp.Application.VBNet/MainWindow.vb | 2 +- .../content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb | 2 +- .../content/GtkSharp.Widget.VBNet/Gtk_Widget.vb | 2 +- .../content/GtkSharp.Window.VBNet/Gtk_Window.vb | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs index 31a98b31c..067abcef0 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs @@ -13,7 +13,7 @@ namespace GtkNamespace public MainWindow() : this(new Builder("MainWindow.glade")) { } - private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle) + private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow").Handle) { builder.Autoconnect(this); diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs index e4133f658..c3922d697 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Dialog() : this(new Builder("Gtk_Dialog.glade")) { } - private Gtk_Dialog(Builder builder) : base(builder.GetObject("Gtk_Dialog").Handle) + private Gtk_Dialog(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Dialog").Handle) { builder.Autoconnect(this); DefaultResponse = ResponseType.Cancel; diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs index ca4edd24e..e559f3dde 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Widget() : this(new Builder("Gtk_Widget.glade")) { } - private Gtk_Widget(Builder builder) : base(builder.GetObject("Gtk_Widget").Handle) + private Gtk_Widget(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Widget").Handle) { builder.Autoconnect(this); } diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs index e4b68797f..77511283a 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Window() : this(new Builder("Gtk_Window.glade")) { } - private Gtk_Window(Builder builder) : base(builder.GetObject("Gtk_Window").Handle) + private Gtk_Window(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Window").Handle) { builder.Autoconnect(this); } diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs index 316e2f848..02a48fa33 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs @@ -3,7 +3,7 @@ namespace GtkNamespace open Gtk type MainWindow (builder : Builder) as this = - inherit Window(builder.GetObject("MainWindow").Handle) + inherit Window(builder.GetRawOwnedObject("MainWindow").Handle) let mutable _label1 : Label = null let mutable _button1 : Button = null diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs index 369db5478..d2b2021bb 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs @@ -3,7 +3,7 @@ namespace GtkNamespace open Gtk type Gtk_Dialog (builder : Builder) as this = - inherit Dialog(builder.GetObject("Gtk_Dialog").Handle) + inherit Dialog(builder.GetRawOwnedObject("Gtk_Dialog").Handle) do this.DefaultResponse <- ResponseType.Cancel; this.Response.Add(fun _ -> diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs index 7d4d3d4ce..90c5fd43d 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs @@ -3,6 +3,6 @@ namespace GtkNamespace open Gtk type Gtk_Widget (builder : Builder) = - inherit Box(builder.GetObject("Gtk_Widget").Handle) + inherit Box(builder.GetRawOwnedObject("Gtk_Widget").Handle) new() = new Gtk_Widget(new Builder("Gtk_Widget.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs index ab3fb159a..34f3f2c9a 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs @@ -3,6 +3,6 @@ namespace GtkNamespace open Gtk type Gtk_Window (builder : Builder) = - inherit Window(builder.GetObject("Gtk_Window").Handle) + inherit Window(builder.GetRawOwnedObject("Gtk_Window").Handle) new() = new Gtk_Window(new Builder("Gtk_Window.glade")) diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb index f47a06021..8a75a9621 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb @@ -11,7 +11,7 @@ Namespace GtkNamespace Private _button1 As Button Public Sub New (builder as Builder) - MyBase.New(builder.GetObject("MainWindow").Handle) + MyBase.New(builder.GetRawOwnedObject("MainWindow").Handle) builder.Autoconnect (Me) diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb index 05640a7fc..1d78213d5 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Dialog Public Sub New (builder as Builder) - MyBase.New (builder.GetObject("Gtk_Dialog").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Dialog").Handle) builder.Autoconnect (Me) DefaultResponse = ResponseType.Cancel diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb index 49c8ba38c..7cf254110 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Box Public Sub New (builder as Builder) - MyBase.New (builder.GetObject("Gtk_Widget").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Widget").Handle) builder.Autoconnect (Me) End Sub diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb index aaa3a2d5d..c5cdc5466 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Window Public Sub New (builder as Builder) - MyBase.New (builder.GetObject("Gtk_Window").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Window").Handle) builder.Autoconnect (Me) End Sub From 24f3d17d5c323c9ce1707e49d4bc51fe8a09f637 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 19 Mar 2021 18:18:08 +0100 Subject: [PATCH 13/25] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6315ece20..eb30863c0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://dev.azure.com/cra0zy/GtkSharp/_apis/build/status/GtkSharp.GtkSharp?branchName=develop)](https://dev.azure.com/cra0zy/GtkSharp/_build/latest?definitionId=1&branchName=develop) -GtkSharp is a C# wrapper for Gtk and its related components. The component list includes the following libraries: glib, gio, cairo, pango, atk, gdk. This is a fork of https://github.com/mono/gtk-sharp and is maintained completly separatly from that project. +GtkSharp is a C# wrapper for Gtk and its related components. The component list includes the following libraries: glib, gio, cairo, pango, atk, gdk. This is a fork of https://github.com/mono/gtk-sharp and is maintained completely separately from that project. Differences can be seen with the following table: From 354c8e8cf72d68ab7ff459397c5bdafb600678c1 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 19 Mar 2021 19:31:57 +0100 Subject: [PATCH 14/25] Ups, GetRawOwnedObject already returns an IntPtr --- .../content/GtkSharp.Application.CSharp/MainWindow.cs | 2 +- .../content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs | 2 +- .../content/GtkSharp.Widget.CSharp/Gtk_Widget.cs | 2 +- .../content/GtkSharp.Window.CSharp/Gtk_Window.cs | 2 +- .../content/GtkSharp.Application.FSharp/MainWindow.fs | 2 +- .../content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs | 2 +- .../content/GtkSharp.Widget.FSharp/Gtk_Widget.fs | 2 +- .../content/GtkSharp.Window.FSharp/Gtk_Window.fs | 2 +- .../content/GtkSharp.Application.VBNet/MainWindow.vb | 2 +- .../content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb | 2 +- .../content/GtkSharp.Widget.VBNet/Gtk_Widget.vb | 2 +- .../content/GtkSharp.Window.VBNet/Gtk_Window.vb | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs index 067abcef0..a6fc08a26 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs @@ -13,7 +13,7 @@ namespace GtkNamespace public MainWindow() : this(new Builder("MainWindow.glade")) { } - private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow").Handle) + private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow")) { builder.Autoconnect(this); diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs index c3922d697..5f7d60f10 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Dialog() : this(new Builder("Gtk_Dialog.glade")) { } - private Gtk_Dialog(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Dialog").Handle) + private Gtk_Dialog(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Dialog")) { builder.Autoconnect(this); DefaultResponse = ResponseType.Cancel; diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs index e559f3dde..88c911502 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Widget() : this(new Builder("Gtk_Widget.glade")) { } - private Gtk_Widget(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Widget").Handle) + private Gtk_Widget(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Widget")) { builder.Autoconnect(this); } diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs index 77511283a..2b863d03c 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs @@ -8,7 +8,7 @@ namespace GtkNamespace { public Gtk_Window() : this(new Builder("Gtk_Window.glade")) { } - private Gtk_Window(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Window").Handle) + private Gtk_Window(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Window")) { builder.Autoconnect(this); } diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs index 02a48fa33..03ffbc5d7 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs @@ -3,7 +3,7 @@ namespace GtkNamespace open Gtk type MainWindow (builder : Builder) as this = - inherit Window(builder.GetRawOwnedObject("MainWindow").Handle) + inherit Window(builder.GetRawOwnedObject("MainWindow")) let mutable _label1 : Label = null let mutable _button1 : Button = null diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs index d2b2021bb..7e52fb76e 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs @@ -3,7 +3,7 @@ namespace GtkNamespace open Gtk type Gtk_Dialog (builder : Builder) as this = - inherit Dialog(builder.GetRawOwnedObject("Gtk_Dialog").Handle) + inherit Dialog(builder.GetRawOwnedObject("Gtk_Dialog")) do this.DefaultResponse <- ResponseType.Cancel; this.Response.Add(fun _ -> diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs index 90c5fd43d..2812ea947 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs @@ -3,6 +3,6 @@ namespace GtkNamespace open Gtk type Gtk_Widget (builder : Builder) = - inherit Box(builder.GetRawOwnedObject("Gtk_Widget").Handle) + inherit Box(builder.GetRawOwnedObject("Gtk_Widget")) new() = new Gtk_Widget(new Builder("Gtk_Widget.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs index 34f3f2c9a..a4f3fc885 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs @@ -3,6 +3,6 @@ namespace GtkNamespace open Gtk type Gtk_Window (builder : Builder) = - inherit Window(builder.GetRawOwnedObject("Gtk_Window").Handle) + inherit Window(builder.GetRawOwnedObject("Gtk_Window")) new() = new Gtk_Window(new Builder("Gtk_Window.glade")) diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb index 8a75a9621..5a1f6fa05 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb @@ -11,7 +11,7 @@ Namespace GtkNamespace Private _button1 As Button Public Sub New (builder as Builder) - MyBase.New(builder.GetRawOwnedObject("MainWindow").Handle) + MyBase.New(builder.GetRawOwnedObject("MainWindow")) builder.Autoconnect (Me) diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb index 1d78213d5..e4b15f60b 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Dialog Public Sub New (builder as Builder) - MyBase.New (builder.GetRawOwnedObject("Gtk_Dialog").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Dialog")) builder.Autoconnect (Me) DefaultResponse = ResponseType.Cancel diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb index 7cf254110..359a413e7 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Box Public Sub New (builder as Builder) - MyBase.New (builder.GetRawOwnedObject("Gtk_Widget").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Widget")) builder.Autoconnect (Me) End Sub diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb index c5cdc5466..2e0b365f4 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb @@ -7,7 +7,7 @@ Namespace GtkNamespace Inherits Window Public Sub New (builder as Builder) - MyBase.New (builder.GetRawOwnedObject("Gtk_Window").Handle) + MyBase.New (builder.GetRawOwnedObject("Gtk_Window")) builder.Autoconnect (Me) End Sub From a23d44fb82975711cfcaa400cd7f3e4988d15bbf Mon Sep 17 00:00:00 2001 From: dmg Date: Mon, 22 Mar 2021 23:32:28 +0300 Subject: [PATCH 15/25] Fixed some more APIs according to GTK docs --- Source/Libs/GdkSharp/GdkSharp.metadata | 9 +++++++++ Source/Libs/GtkSharp/GtkSharp.metadata | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Source/Libs/GdkSharp/GdkSharp.metadata b/Source/Libs/GdkSharp/GdkSharp.metadata index 47463959f..570e91878 100644 --- a/Source/Libs/GdkSharp/GdkSharp.metadata +++ b/Source/Libs/GdkSharp/GdkSharp.metadata @@ -76,6 +76,9 @@ false 1 1 + GdkSeat* + true + false GetSupportsComposite GetSupportsInputShapes GetSupportsShapes @@ -121,6 +124,12 @@ GdkWindow* true true + GdkDevice* + true + false + GdkDevice* + true + false 1 1 1 diff --git a/Source/Libs/GtkSharp/GtkSharp.metadata b/Source/Libs/GtkSharp/GtkSharp.metadata index 4119010be..1ac7d7d2e 100644 --- a/Source/Libs/GtkSharp/GtkSharp.metadata +++ b/Source/Libs/GtkSharp/GtkSharp.metadata @@ -854,6 +854,7 @@ 1 1 ProcessEvent + out out out out @@ -906,6 +907,7 @@ out 1 out + out out 1 1 From 9be7e092a803e9de7b323e6d5bdf91337650f61f Mon Sep 17 00:00:00 2001 From: Sergii Fesenko Date: Sat, 27 Mar 2021 20:11:59 +0200 Subject: [PATCH 16/25] Signal.Handler: correct flag check (#233) --- Source/Libs/GLibSharp/Signal.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Libs/GLibSharp/Signal.cs b/Source/Libs/GLibSharp/Signal.cs index 2d152434f..dd94e6c38 100644 --- a/Source/Libs/GLibSharp/Signal.cs +++ b/Source/Libs/GLibSharp/Signal.cs @@ -211,11 +211,10 @@ namespace GLib { public Delegate Handler { get { - InvocationHint hint = (InvocationHint) Marshal.PtrToStructure (g_signal_get_invocation_hint (obj.Handle), typeof (InvocationHint)); - if (hint.run_type == Flags.RunFirst) - return before_handler; - else - return after_handler; + var hint = (InvocationHint) Marshal.PtrToStructure (g_signal_get_invocation_hint (obj.Handle), typeof (InvocationHint)); + return hint.run_type.HasFlag(Flags.RunFirst) + ? before_handler + : after_handler; } } From ba97d6bff512d1c1aa174239765545d4b3b8b76f Mon Sep 17 00:00:00 2001 From: dmg Date: Mon, 29 Mar 2021 23:39:12 +0300 Subject: [PATCH 17/25] Pixbuf Windows fixes (utf8 suffix) Some Pixbuf, PixbufAnimation functions on Windows is exported with "_utf8" suffix. I hid generated versions, copied and modified code to use "_utf8" on Windows. Also hid "gdk_pixbuf_new_from_resource*", "gdk_pixbuf_animation_new_from_resource" because they are using GResources and we already have constructors for .NET resources. --- Source/Libs/GdkSharp/GdkSharp.metadata | 13 +++++- Source/Libs/GdkSharp/Pixbuf.cs | 62 +++++++++++++++++++++---- Source/Libs/GdkSharp/PixbufAnimation.cs | 15 ++++++ 3 files changed, 79 insertions(+), 11 deletions(-) diff --git a/Source/Libs/GdkSharp/GdkSharp.metadata b/Source/Libs/GdkSharp/GdkSharp.metadata index 570e91878..028434825 100644 --- a/Source/Libs/GdkSharp/GdkSharp.metadata +++ b/Source/Libs/GdkSharp/GdkSharp.metadata @@ -87,8 +87,15 @@ 1 1 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 1 + 1 + 1 1 1 true @@ -97,6 +104,7 @@ 1 1 1 + 1 1 1 1 @@ -107,6 +115,9 @@ true true true + 1 + 1 + 1 1 1 out diff --git a/Source/Libs/GdkSharp/Pixbuf.cs b/Source/Libs/GdkSharp/Pixbuf.cs index d438da592..cba3df10a 100644 --- a/Source/Libs/GdkSharp/Pixbuf.cs +++ b/Source/Libs/GdkSharp/Pixbuf.cs @@ -39,6 +39,48 @@ namespace Gdk { public partial class Pixbuf { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_gdk_pixbuf_new_from_file(IntPtr filename, out IntPtr error); + static d_gdk_pixbuf_new_from_file gdk_pixbuf_new_from_file = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_utf8" : "gdk_pixbuf_new_from_file")); + + public Pixbuf(string filename) : base(IntPtr.Zero) + { + IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename); + IntPtr error = IntPtr.Zero; + Raw = gdk_pixbuf_new_from_file(native_filename, out error); + GLib.Marshaller.Free(native_filename); + if (error != IntPtr.Zero) throw new GLib.GException(error); + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_gdk_pixbuf_new_from_file_at_scale(IntPtr filename, int width, int height, bool preserve_aspect_ratio, out IntPtr error); + static d_gdk_pixbuf_new_from_file_at_scale gdk_pixbuf_new_from_file_at_scale = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_at_scale_utf8" : "gdk_pixbuf_new_from_file_at_scale")); + + public Pixbuf(string filename, int width, int height, bool preserve_aspect_ratio) : base(IntPtr.Zero) + { + IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename); + IntPtr error = IntPtr.Zero; + Raw = gdk_pixbuf_new_from_file_at_scale(native_filename, width, height, preserve_aspect_ratio, out error); + GLib.Marshaller.Free(native_filename); + if (error != IntPtr.Zero) throw new GLib.GException(error); + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_gdk_pixbuf_new_from_file_at_size(IntPtr filename, int width, int height, out IntPtr error); + static d_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_at_size_utf8" : "gdk_pixbuf_new_from_file_at_size")); + + public Pixbuf(string filename, int width, int height) : base(IntPtr.Zero) + { + IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename); + IntPtr error = IntPtr.Zero; + Raw = gdk_pixbuf_new_from_file_at_size(native_filename, width, height, out error); + GLib.Marshaller.Free(native_filename); + if (error != IntPtr.Zero) throw new GLib.GException(error); + } + public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero) { using (PixbufLoader pl = new PixbufLoader (stream)) { @@ -202,12 +244,12 @@ namespace Gdk { delegate IntPtr d_gdk_pixbuf_get_pixels(IntPtr raw); static d_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_get_pixels")); - public IntPtr Pixels { - get { - IntPtr ret = gdk_pixbuf_get_pixels (Handle); - return ret; - } - } + public IntPtr Pixels { + get { + IntPtr ret = gdk_pixbuf_get_pixels (Handle); + return ret; + } + } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate IntPtr d_gdk_pixbuf_get_formats(); static d_gdk_pixbuf_get_formats gdk_pixbuf_get_formats = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_get_formats")); @@ -226,7 +268,8 @@ namespace Gdk { } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool d_gdk_pixbuf_save(IntPtr raw, IntPtr filename, IntPtr type, out IntPtr error, IntPtr dummy); - static d_gdk_pixbuf_save gdk_pixbuf_save = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_save")); + static d_gdk_pixbuf_save gdk_pixbuf_save = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_save_utf8" : "gdk_pixbuf_save")); public unsafe bool Save(string filename, string type) { IntPtr error = IntPtr.Zero; @@ -312,7 +355,8 @@ namespace Gdk { } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool d_gdk_pixbuf_savev(IntPtr raw, IntPtr filename, IntPtr type, IntPtr[] option_keys, IntPtr[] option_values, out IntPtr error); - static d_gdk_pixbuf_savev gdk_pixbuf_savev = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_savev")); + static d_gdk_pixbuf_savev gdk_pixbuf_savev = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_savev_utf8" : "gdk_pixbuf_savev")); public unsafe bool Savev(string filename, string type, string[] option_keys, string[] option_values) { IntPtr error = IntPtr.Zero; @@ -332,5 +376,3 @@ namespace Gdk { } } } - - diff --git a/Source/Libs/GdkSharp/PixbufAnimation.cs b/Source/Libs/GdkSharp/PixbufAnimation.cs index 0a950e2cb..721ebe91e 100644 --- a/Source/Libs/GdkSharp/PixbufAnimation.cs +++ b/Source/Libs/GdkSharp/PixbufAnimation.cs @@ -21,9 +21,24 @@ namespace Gdk { using System; + using System.Runtime.InteropServices; public partial class PixbufAnimation { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_gdk_pixbuf_animation_new_from_file(IntPtr filename, out IntPtr error); + static d_gdk_pixbuf_animation_new_from_file gdk_pixbuf_animation_new_from_file = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), + FuncLoader.IsWindows ? "gdk_pixbuf_animation_new_from_file_utf8" : "gdk_pixbuf_animation_new_from_file")); + + public PixbufAnimation(string filename) : base(IntPtr.Zero) + { + IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename); + IntPtr error = IntPtr.Zero; + Raw = gdk_pixbuf_animation_new_from_file(native_filename, out error); + GLib.Marshaller.Free(native_filename); + if (error != IntPtr.Zero) throw new GLib.GException(error); + } + public PixbufAnimation (System.IO.Stream stream) : base (new PixbufLoader (stream).AnimationHandle) {} public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero) From 8ac28929386c297a9c60e8e0dc828b44c545d32c Mon Sep 17 00:00:00 2001 From: zii-dmg Date: Thu, 1 Apr 2021 13:38:54 +0300 Subject: [PATCH 18/25] TreePath improvements (#235) * TreePath(int[]) constructor is now using one API call instead of many. * Indices property is now using one API call instead of two. --- Source/Libs/GtkSharp/GtkSharp.metadata | 2 ++ Source/Libs/GtkSharp/TreePath.cs | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Source/Libs/GtkSharp/GtkSharp.metadata b/Source/Libs/GtkSharp/GtkSharp.metadata index 1ac7d7d2e..bcb62638c 100644 --- a/Source/Libs/GtkSharp/GtkSharp.metadata +++ b/Source/Libs/GtkSharp/GtkSharp.metadata @@ -50,7 +50,9 @@ 1 1 1 + 1 1 + 1 1 1 true diff --git a/Source/Libs/GtkSharp/TreePath.cs b/Source/Libs/GtkSharp/TreePath.cs index 8f3ef014b..9977b6cec 100644 --- a/Source/Libs/GtkSharp/TreePath.cs +++ b/Source/Libs/GtkSharp/TreePath.cs @@ -20,24 +20,27 @@ namespace Gtk { public partial class TreePath { - // Patch submitted by malte on bug #49518 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate IntPtr d_gtk_tree_path_get_indices(IntPtr raw); - static d_gtk_tree_path_get_indices gtk_tree_path_get_indices = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_get_indices")); + delegate IntPtr d_gtk_tree_path_get_indices_with_depth(IntPtr raw, out int depth); + static d_gtk_tree_path_get_indices_with_depth gtk_tree_path_get_indices_with_depth = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_get_indices_with_depth")); public int [] Indices { get { - IntPtr ptr = gtk_tree_path_get_indices(Handle); - int [] arr = new int [Depth]; - Marshal.Copy (ptr, arr, 0, Depth); + IntPtr arrPtr = gtk_tree_path_get_indices_with_depth(Handle, out int depth); + int[] arr = new int[depth]; + if (arrPtr != IntPtr.Zero) + Marshal.Copy(arrPtr, arr, 0, depth); return arr; } } - public TreePath (int[] indices) : this () + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate IntPtr d_gtk_tree_path_new_from_indicesv(int[] indices, UIntPtr length); + static d_gtk_tree_path_new_from_indicesv gtk_tree_path_new_from_indicesv = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_new_from_indicesv")); + + public TreePath (int[] indices) { - foreach (int i in indices) - AppendIndex (i); + Raw = gtk_tree_path_new_from_indicesv(indices, (UIntPtr)indices.Length); } public override bool Equals (object o) From bfcf29b070546dc035a5fe68103f86a32751bad8 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 2 Apr 2021 18:39:28 +0200 Subject: [PATCH 19/25] [GtkSource] Add array information to Language classes --- Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata index d42891890..fd30926c8 100644 --- a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata +++ b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata @@ -23,6 +23,7 @@ + Mark Mark CompletionProvider @@ -34,6 +35,14 @@ async async async + + true + true + true + true + true + true + SourceView From 94ea7051f90dd737d2d65e4b21c18dcf9f25133b Mon Sep 17 00:00:00 2001 From: dmg Date: Thu, 1 Apr 2021 19:46:39 +0300 Subject: [PATCH 20/25] GException improvements with multithreading Read all GError fields in GException constructor and free GError memory. Quote from gtksharp2 fix: The original impl did not take into account exceptions marshalling across thread boundaries so it could end up with the error being accessed after being disposed. --- Source/Libs/GLibSharp/GException.cs | 40 +++++++++-------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/Source/Libs/GLibSharp/GException.cs b/Source/Libs/GLibSharp/GException.cs index 4160b0bb0..0c76244dd 100644 --- a/Source/Libs/GLibSharp/GException.cs +++ b/Source/Libs/GLibSharp/GException.cs @@ -26,11 +26,15 @@ namespace GLib { public class GException : Exception { - IntPtr errptr; - - public GException (IntPtr errptr) : base () + string msg; + + public GException (IntPtr errptr) { - this.errptr = errptr; + var err = (GError)Marshal.PtrToStructure(errptr, typeof(GError)); + Domain = err.Domain; + Code = err.Code; + msg = Marshaller.Utf8PtrToString(err.Msg); + g_clear_error(ref errptr); } struct GError { @@ -39,34 +43,14 @@ namespace GLib { public IntPtr Msg; } - public int Code { - get { - GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError)); - return err.Code; - } - } + public int Code { get; private set; } - public int Domain { - get { - GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError)); - return err.Domain; - } - } + public int Domain { get; private set; } + + public override string Message => msg; - public override string Message { - get { - GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError)); - return Marshaller.Utf8PtrToString (err.Msg); - } - } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void d_g_clear_error(ref IntPtr errptr); static d_g_clear_error g_clear_error = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_clear_error")); - ~GException () - { - g_clear_error (ref errptr); - } } } - - From 7995f132e19e18b8dae94359246540f059e53a86 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 2 Apr 2021 19:24:05 +0200 Subject: [PATCH 21/25] Bump required nuget in templates --- .../content/GtkSharp.Application.CSharp/GtkNamespace.csproj | 2 +- .../content/GtkSharp.Application.FSharp/GtkNamespace.fsproj | 2 +- .../content/GtkSharp.Application.VBNet/GtkNamespace.vbproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj index 841977aa2..d4b9b8b63 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj @@ -13,7 +13,7 @@ - + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj index b4506fadf..d8991da16 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj @@ -18,7 +18,7 @@ - + diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj index 841977aa2..d4b9b8b63 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj @@ -13,7 +13,7 @@ - + From 43bcf0ace06a92087212da8ad77c7fccd26b9e49 Mon Sep 17 00:00:00 2001 From: dmg Date: Sat, 3 Apr 2021 19:02:50 +0300 Subject: [PATCH 22/25] Extend XSD schema Added some elements that is supported in GapiCodegen to reduce number of validation errors in build log. --- Source/Libs/Shared/Gapi.xsd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Libs/Shared/Gapi.xsd b/Source/Libs/Shared/Gapi.xsd index 7ef1b8bc3..bd1eb8d1a 100644 --- a/Source/Libs/Shared/Gapi.xsd +++ b/Source/Libs/Shared/Gapi.xsd @@ -158,6 +158,7 @@ + @@ -188,6 +189,7 @@ + From f86752770b7a88ed56d33b1c415dbee46ecccb4e Mon Sep 17 00:00:00 2001 From: dmg Date: Sat, 3 Apr 2021 18:57:01 +0300 Subject: [PATCH 23/25] Fixed more metadata Added element types, callback scopes. Removed invalid rules (fewer "no matched nodes" messages in log). Removed garbage property in GtkSharp-api.xml. --- Source/Libs/AtkSharp/AtkSharp.metadata | 2 -- Source/Libs/GdkSharp/GdkSharp.metadata | 11 ++++--- Source/Libs/GtkSharp/GtkSharp-api.xml | 1 - Source/Libs/GtkSharp/GtkSharp.metadata | 31 +++++++++++-------- .../GtkSourceSharp/GtkSourceSharp.metadata | 18 ++++++++--- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Source/Libs/AtkSharp/AtkSharp.metadata b/Source/Libs/AtkSharp/AtkSharp.metadata index b01be8585..b13138c16 100644 --- a/Source/Libs/AtkSharp/AtkSharp.metadata +++ b/Source/Libs/AtkSharp/AtkSharp.metadata @@ -37,8 +37,6 @@ 1 AtkAttribute* AtkAttribute* - AtkAttribute* - AtkAttribute* diff --git a/Source/Libs/GdkSharp/GdkSharp.metadata b/Source/Libs/GdkSharp/GdkSharp.metadata index 028434825..8d937d577 100644 --- a/Source/Libs/GdkSharp/GdkSharp.metadata +++ b/Source/Libs/GdkSharp/GdkSharp.metadata @@ -131,10 +131,15 @@ GdkWindow* true true - 1 GdkWindow* true true + + + + + + GdkDevice* true false @@ -180,14 +185,10 @@ 1 1 1 - 1 - 1 - 1 GdkSeat 128 - diff --git a/Source/Libs/GtkSharp/GtkSharp-api.xml b/Source/Libs/GtkSharp/GtkSharp-api.xml index 39d1d8127..86f5d3f4f 100644 --- a/Source/Libs/GtkSharp/GtkSharp-api.xml +++ b/Source/Libs/GtkSharp/GtkSharp-api.xml @@ -28289,7 +28289,6 @@ - diff --git a/Source/Libs/GtkSharp/GtkSharp.metadata b/Source/Libs/GtkSharp/GtkSharp.metadata index bcb62638c..1293f72e6 100644 --- a/Source/Libs/GtkSharp/GtkSharp.metadata +++ b/Source/Libs/GtkSharp/GtkSharp.metadata @@ -12,7 +12,6 @@ 1 1 1 - 1 1 1 1 @@ -77,7 +76,6 @@ GetEventsPending const-gchar* 1 - 1 1 1 1 @@ -106,7 +104,6 @@ CornerBottomLeft | CornerBottomRight CornerTopLeft | CornerBottomLeft CornerTopRight | CornerBottomRight - 1 1 1 1 @@ -282,7 +279,6 @@ call call GtkCellRenderer* - AttributesApplied 1 1 GdkRGBA @@ -379,11 +375,18 @@ SelectedAll UnselectedAll + call + GtkFlowBoxChild* + false + true GtkButton* GtkButton* 1 1 1 + GdkEventSequence* + false + true 1 1 IsChildDetached @@ -458,6 +461,10 @@ SelectedAll UnselectedAll ListRowActivated + call + GtkListBoxRow* + false + true 1 1 out @@ -498,6 +505,9 @@ ShowedConnectToServer ShowEnteredLocation ShowedOtherLocations + GFile* + true + true 1 1 IsEmbedded @@ -647,7 +657,6 @@ SetIcon GetIcon Icon - out 1 out out @@ -865,7 +874,6 @@ GetWidgetPath out GetIsRealized - out GetHasDefault GetHasFocus out @@ -948,8 +956,6 @@ slider_detail StepperDetail - gchar* - stepper_detail 1 1 @@ -958,10 +964,6 @@ 1 1 1 - 1 - 1 - 1 - 1 1 1 1 @@ -983,7 +985,6 @@ 1 1 1 - 1 1 out @@ -1012,6 +1013,10 @@ + async + async + async + true true diff --git a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata index fd30926c8..22a9bdc6b 100644 --- a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata +++ b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata @@ -24,11 +24,19 @@ - Mark - Mark - CompletionProvider - Encoding - Encoding + GtkSourceMark* + true + false + GtkSourceMark* + true + false + GtkSourceCompletionProvider* + GtkSourceEncoding* + true + false + GtkSourceEncoding* + true + false notify async notify From c81830ad50920c80e77ffc536a05d75db9000ad5 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 6 Apr 2021 09:46:09 +1000 Subject: [PATCH 24/25] Fix some mistakes in GtkSourceSearchContext wrapper The match_start and match_end arguments in the searching functions of GtkSourceSearchContext are out parameters. --- Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata index 22a9bdc6b..7310b8252 100644 --- a/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata +++ b/Source/Libs/GtkSourceSharp/GtkSourceSharp.metadata @@ -14,12 +14,20 @@ EmitChanged EmitCanRedoChanged EmitCanUndoChanged - ref - ref + out + out out ref ref + out + out out + out + out + out + out + out + out From aa1095a02de2dc90c5fc59855bc21d23a0646e79 Mon Sep 17 00:00:00 2001 From: zii-dmg Date: Thu, 22 Apr 2021 17:50:39 +0300 Subject: [PATCH 25/25] Use embedded resources in CssProvider.LoadFromResource (#238) --- Source/Libs/GtkSharp/CssProvider.cs | 27 ++++++++++++++++++++++++++ Source/Libs/GtkSharp/GtkSharp.metadata | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 Source/Libs/GtkSharp/CssProvider.cs diff --git a/Source/Libs/GtkSharp/CssProvider.cs b/Source/Libs/GtkSharp/CssProvider.cs new file mode 100644 index 000000000..764498150 --- /dev/null +++ b/Source/Libs/GtkSharp/CssProvider.cs @@ -0,0 +1,27 @@ +namespace Gtk +{ + using System; + using System.IO; + using System.Reflection; + + public partial class CssProvider + { + public bool LoadFromResource(string resource) => LoadFromResource(Assembly.GetCallingAssembly(), resource); + + public bool LoadFromResource(Assembly assembly, string resource) + { + if (assembly == null) + assembly = Assembly.GetCallingAssembly(); + + Stream stream = assembly.GetManifestResourceStream(resource); + if (stream == null) + throw new ArgumentException("'" + resource + "' is not a valid resource name of assembly '" + assembly + "'.", nameof(resource)); + + using (var reader = new StreamReader(stream)) + { + string data = reader.ReadToEnd(); + return LoadFromData(data); + } + } + } +} diff --git a/Source/Libs/GtkSharp/GtkSharp.metadata b/Source/Libs/GtkSharp/GtkSharp.metadata index 1293f72e6..c0ff7cd3a 100644 --- a/Source/Libs/GtkSharp/GtkSharp.metadata +++ b/Source/Libs/GtkSharp/GtkSharp.metadata @@ -1017,6 +1017,8 @@ async async + 1 + true true