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:
authorJose Medrano <josmed@microsoft.com>2022-03-18 13:42:12 +0300
committerJose Medrano <josmed@microsoft.com>2022-03-18 13:45:24 +0300
commit7015a04bda39a0e16cace7fb98d11cd23bd08e62 (patch)
tree02bba919493b78f4c723aed9e33bea190ca8cb5f
parent9bad871dd2ac47f48dbf25a67c023aaa52033f56 (diff)
[XamMac] Ensures AlertDialogBackend has parenting and centers window when shows
-rw-r--r--Xwt.XamMac/Xwt.Mac/AlertDialogBackend.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/AlertDialogBackend.cs b/Xwt.XamMac/Xwt.Mac/AlertDialogBackend.cs
index acf66e21..64a4fc52 100644
--- a/Xwt.XamMac/Xwt.Mac/AlertDialogBackend.cs
+++ b/Xwt.XamMac/Xwt.Mac/AlertDialogBackend.cs
@@ -112,6 +112,19 @@ namespace Xwt.Mac
Window.ReleasedWhenClosed = true;
if (win != null)
return sortedButtons [(int)this.RunSheetModal (win) - 1000];
+
+ if (win == null)
+ {
+ //a modal dialog needs parent window so we try take the current key
+ win = NSApplication.SharedApplication.ModalWindow ?? NSApplication.SharedApplication.KeyWindow;
+ }
+
+ if (win != null)
+ {
+ win.AddChildWindow(this.Window, NSWindowOrderingMode.Above);
+ }
+
+ Util.CenterWindow(this.Window, win);
return sortedButtons [(int)this.RunModal () - 1000];
}