From dac3dc824083ba5fde4896b145a41d0e3117e306 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Thu, 28 May 2020 11:50:35 -0700 Subject: [PATCH 1/3] Mac: Fix setting width/height of window after it is loaded --- src/Eto.Mac/Forms/MacWindow.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Eto.Mac/Forms/MacWindow.cs b/src/Eto.Mac/Forms/MacWindow.cs index f156710357..4384bb26f1 100644 --- a/src/Eto.Mac/Forms/MacWindow.cs +++ b/src/Eto.Mac/Forms/MacWindow.cs @@ -580,8 +580,14 @@ public override Size Size set { var oldFrame = Control.Frame; - var newFrame = oldFrame.SetSize(value); - newFrame.Y = (nfloat)Math.Max(0, oldFrame.Y - (value.Height - oldFrame.Height)); + var newFrame = oldFrame; + if (value.Width >= 0) + newFrame.Width = value.Width; + if (value.Height > 0) + { + newFrame.Height = value.Height; + newFrame.Y = (nfloat)Math.Max(0, oldFrame.Y - (value.Height - oldFrame.Height)); + } Control.SetFrame(newFrame, true); UserPreferredSize = value; SetAutoSize(); From 55e42ce4df0951c4bf75bff80d14519f5ee60fd7 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Thu, 28 May 2020 11:51:32 -0700 Subject: [PATCH 2/3] Mac: Fix .app bundle errors when using msbuild --- src/Eto.Mac/build/BundleDotNetCore.targets | 2 +- src/Eto.Mac/build/BundleMono.targets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eto.Mac/build/BundleDotNetCore.targets b/src/Eto.Mac/build/BundleDotNetCore.targets index 15a3551a10..d12b03d0b5 100644 --- a/src/Eto.Mac/build/BundleDotNetCore.targets +++ b/src/Eto.Mac/build/BundleDotNetCore.targets @@ -63,7 +63,7 @@ - + diff --git a/src/Eto.Mac/build/BundleMono.targets b/src/Eto.Mac/build/BundleMono.targets index 484c9d8bab..e19f39884a 100644 --- a/src/Eto.Mac/build/BundleMono.targets +++ b/src/Eto.Mac/build/BundleMono.targets @@ -165,7 +165,7 @@ - + From 20a4c07a084b0da936db96f18dd890bcd803209c Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Thu, 28 May 2020 11:52:06 -0700 Subject: [PATCH 3/3] Auto-load handler type assembly if not found in platform This fixes auto-loading subclasses when they are in a different assembly as the type with the handler --- src/Eto/Platform.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Eto/Platform.cs b/src/Eto/Platform.cs index 7502d79829..6fb25501f6 100644 --- a/src/Eto/Platform.cs +++ b/src/Eto/Platform.cs @@ -611,14 +611,24 @@ internal HandlerInfo FindHandler(Type type) return info; var handler = type.GetCustomAttribute(true); - Func activator; - if (handler != null && instantiatorMap.TryGetValue(handler.Type, out activator)) + if (handler != null) { - var autoInit = handler.Type.GetCustomAttribute(true); - info = new HandlerInfo(autoInit == null || autoInit.Initialize, activator); - handlerMap.Add(type, info); - return info; + if (instantiatorMap.TryGetValue(handler.Type, out var activator)) + { + var autoInit = handler.Type.GetCustomAttribute(true); + info = new HandlerInfo(autoInit == null || autoInit.Initialize, activator); + handlerMap.Add(type, info); + return info; + } + // load the assembly of the handler type (needed when type is a subclass) + if (!loadedAssemblies.Contains(handler.Type.GetAssembly())) + { + LoadAssembly(handler.Type.GetAssembly()); + return FindHandler(type); + } } + + // load the assembly of the target type (can be a subclass) if (!loadedAssemblies.Contains(type.GetAssembly())) { LoadAssembly(type.GetAssembly());