Upgrade Eto.Forms to 2.8.3

This allows removing several workarounds due to upstream fixes.
This commit is contained in:
Ben Olden-Cooligan 2024-03-15 18:48:51 -07:00
parent c8a41e322e
commit 0a7349ced6
15 changed files with 15 additions and 75 deletions

View File

@ -27,7 +27,7 @@
<ProjectReference Include="..\NAPS2.Lib.Gtk\NAPS2.Lib.Gtk.csproj" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.8.2" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.8.3" />
<!-- This shouldn't need a reference normally, but otherwise "dotnet restore" doesn't pick
it up, which breaks the flatpak build. -->
<PackageReference Include="Microsoft.NETCore.App" Version="2.1.*" />

View File

@ -24,7 +24,7 @@
<ProjectReference Include="..\NAPS2.Lib.Mac\NAPS2.Lib.Mac.csproj" />
<PackageReference Include="Eto.Platform.macOS" Version="2.8.2" />
<PackageReference Include="Eto.Platform.macOS" Version="2.8.3" />
</ItemGroup>
<ItemGroup>

View File

@ -16,7 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Images\NAPS2.Images.csproj" />
<PackageReference Include="GtkSharp" Version="3.24.24.38" />
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
</ItemGroup>
<ItemGroup>

View File

@ -17,7 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Images\NAPS2.Images.csproj" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.8.2" Condition="'$(TargetFramework)' == 'net6'" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.8.3" Condition="'$(TargetFramework)' == 'net6'" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net6'">

View File

@ -16,8 +16,8 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Images.Gtk\NAPS2.Images.Gtk.csproj" />
<ProjectReference Include="..\NAPS2.Lib\NAPS2.Lib.csproj" />
<PackageReference Include="Eto.Forms" Version="2.8.2" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.8.2" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.8.3" />
</ItemGroup>
<ItemGroup>

View File

@ -26,20 +26,6 @@ public class MacEtoPlatform : EtoPlatform
return new Application(Platforms.macOS);
}
public override void Invoke(Application application, Action action)
{
// TODO: Eto PR to use this instead of DispatchQueue.MainQueue
// Invoking directly on DispatchQueue ignores the run loop mode, which can mean something like spawning a modal
// form doesn't behave normally.
// https://stackoverflow.com/questions/9335434/whats-the-difference-between-performselectoronmainthread-and-dispatch-async
NSApplication.SharedApplication.InvokeOnMainThread(action);
}
public override void AsyncInvoke(Application application, Action action)
{
NSApplication.SharedApplication.BeginInvokeOnMainThread(action);
}
public override IListView<T> CreateListView<T>(ListViewBehavior<T> behavior) =>
new MacListView<T>(behavior);

View File

@ -16,7 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Images.Mac\NAPS2.Images.Mac.csproj" />
<ProjectReference Include="..\NAPS2.Lib\NAPS2.Lib.csproj" />
<PackageReference Include="Eto.Platform.macOS" Version="2.8.2" />
<PackageReference Include="Eto.Platform.macOS" Version="2.8.3" />
</ItemGroup>
<ItemGroup>

View File

@ -30,20 +30,6 @@ public class WinFormsEtoPlatform : EtoPlatform
return new Application(Eto.Platforms.WinForms);
}
public override void RunApplication(Application application, Form mainForm)
{
// We manually run an application rather than using eto as that lets us change the main form
// TODO: PR for eto to handle mainform changes correctly
application.MainForm = mainForm;
mainForm.Show();
var appContext = new WF.ApplicationContext(mainForm.ToNative());
WinFormsDesktopForm.ApplicationContext = appContext;
var setOptionsMethod =
typeof(ApplicationHandler).GetMethod("SetOptions", BindingFlags.Instance | BindingFlags.NonPublic);
setOptionsMethod!.Invoke(application.Handler, Array.Empty<object>());
WF.Application.Run(appContext);
}
public override IListView<T> CreateListView<T>(ListViewBehavior<T> behavior) =>
new WinFormsListView<T>(behavior);

View File

@ -20,8 +20,8 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Lib\NAPS2.Lib.csproj" />
<ProjectReference Include="..\NAPS2.Images.Gdi\NAPS2.Images.Gdi.csproj" />
<PackageReference Include="Eto.Forms" Version="2.8.2" />
<PackageReference Include="Eto.Platform.Windows" Version="2.8.2" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="Eto.Platform.Windows" Version="2.8.3" />
</ItemGroup>
<ItemGroup>

View File

@ -51,7 +51,7 @@ public static class ConsoleEntryPoint
application.UnhandledException += UnhandledException;
application.Initialized += (_, _) => scanning.Execute().ContinueWith(_ => application.Quit());
Invoker.Current = new EtoInvoker(application);
EtoPlatform.Current.RunApplication(application);
application.Run();
}
else
{

View File

@ -42,7 +42,7 @@ public static class GuiEntryPoint
var formFactory = container.Resolve<IFormFactory>();
var desktop = formFactory.Create<DesktopForm>();
EtoPlatform.Current.RunApplication(application, desktop);
application.Run(desktop);
return 0;
}

View File

@ -1,4 +1,3 @@
using Eto.Drawing;
using Eto.Forms;
using NAPS2.EtoForms.Layout;
@ -27,17 +26,6 @@ public abstract class EtoDialogBase : Dialog, IFormBase
base.OnPreLoad(e);
}
// TODO: PR for Eto to integrate this
public new Icon Icon
{
get => base.Icon;
set
{
base.Icon = value;
EtoPlatform.Current.ShowIcon(this);
}
}
public FormStateController FormStateController { get; }
public LayoutController LayoutController { get; } = new();

View File

@ -13,18 +13,18 @@ public class EtoInvoker : IInvoker
public void Invoke(Action action)
{
EtoPlatform.Current.Invoke(_application, action);
_application.Invoke(action);
}
public void InvokeDispatch(Action action)
{
EtoPlatform.Current.AsyncInvoke(_application, action);
_application.AsyncInvoke(action);
}
public T InvokeGet<T>(Func<T> func)
{
T value = default!;
EtoPlatform.Current.Invoke(_application, () => value = func());
_application.Invoke(() => value = func());
return value;
}
}

View File

@ -37,26 +37,6 @@ public abstract class EtoPlatform
{
}
public virtual void RunApplication(Application application, Form mainForm)
{
application.Run(mainForm);
}
public virtual void RunApplication(Application application)
{
application.Run();
}
public virtual void Invoke(Application application, Action action)
{
application.Invoke(action);
}
public virtual void AsyncInvoke(Application application, Action action)
{
application.AsyncInvoke(action);
}
public virtual void SetContainerSize(Window window, Control container, Size size, int padding)
{
}

View File

@ -37,7 +37,7 @@
<PackageReference Include="MimeKit" Version="1.22.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.6" />
<PackageReference Include="Eto.Forms" Version="2.8.2" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.5" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
</ItemGroup>