From f6c1ecf3e4d8ece568e3009b70979f10e511c261 Mon Sep 17 00:00:00 2001 From: Jose Medrano Date: Wed, 6 Apr 2022 16:45:07 +0200 Subject: [WindowFrameBackend] TransientFrame only associates parenting in both windows (this is taked into account when the window is shown) --- Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'Xwt.XamMac') diff --git a/Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs b/Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs index d5bde8af..b520a67b 100644 --- a/Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs @@ -334,20 +334,14 @@ namespace Xwt.Mac void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend parent) { + //TODO: why this? if (!((IWindowFrameBackend)this).ShowInTaskbar) Window.StyleMask &= ~NSWindowStyle.Miniaturizable; - var win = Window as NSWindow ?? ApplicationContext.Toolkit.GetNativeWindow (parent) as NSWindow; - - if (Window.ParentWindow != win) { - // remove from the previous parent - if (Window.ParentWindow != null) - Window.ParentWindow.RemoveChildWindow (Window); - - Window.ParentWindow = win; - // A window must be visible to be added to a parent. See InternalShow(). - if (Visible) - Window.ParentWindow.AddChildWindow (Window, NSWindowOrderingMode.Above); + //we try to get the native object from the parameter if not we fallback into the real parent + NSWindow nParent = (ApplicationContext.Toolkit.GetNativeWindow(parent) as NSWindow) ?? Window.ParentWindow; + if (nParent != Window.ParentWindow) { + Window.ParentWindow = nParent; } } -- cgit v1.2.3