Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xwt.XamMac/Xwt.Mac/DialogBackend.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/DialogBackend.cs b/Xwt.XamMac/Xwt.Mac/DialogBackend.cs
index c50c012b..effc9372 100644
--- a/Xwt.XamMac/Xwt.Mac/DialogBackend.cs
+++ b/Xwt.XamMac/Xwt.Mac/DialogBackend.cs
@@ -167,14 +167,21 @@ namespace Xwt.Mac
public void RunLoop (IWindowFrameBackend parent)
{
- Visible = true;
- modalSessionRunning = true;
+ NSWindow nsParent = parent?.Window as NSWindow;
+ if (nsParent == null)
+ {
+ //a modal dialog needs parent window so we try take the current key
+ nsParent = NSApplication.SharedApplication.ModalWindow ?? NSApplication.SharedApplication.KeyWindow;
+ }
- NSWindow nsParent = parent.Window as NSWindow;
if (nsParent != null && nsParent.IsVisible)
{
nsParent.AddChildWindow(this, NSWindowOrderingMode.Above);
}
+
+ Visible = true;
+ modalSessionRunning = true;
+
Util.CenterWindow(this, nsParent);
NSApplication.SharedApplication.RunModalForWindow (this);
}