diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-04-06 17:45:07 +0300 |
---|---|---|
committer | Jose Medrano <josmed@microsoft.com> | 2022-04-06 17:45:07 +0300 |
commit | f6c1ecf3e4d8ece568e3009b70979f10e511c261 (patch) | |
tree | 354274165ed95ccc56cb504f34833fa0009cad77 | |
parent | 54bf3faa58f3474670e732136d3bd54e9d78c168 (diff) |
[WindowFrameBackend] TransientFrame only associates parenting in both windows
(this is taked into account when the window is shown)
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/WindowFrameBackend.cs | 16 |
1 files changed, 5 insertions, 11 deletions
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; } } |