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-29 18:50:05 +0300
committerGitHub <noreply@github.com>2022-03-29 18:50:05 +0300
commit87b0a435e2f3eec34afc026e9c2eb1448ba6842c (patch)
treeac09f076f494e65e1e70ca47fc347dcb0a500a94
parent13d7a18c5bbc6f882a1850dfa7afb05ee643aa6a (diff)
parent7015a04bda39a0e16cace7fb98d11cd23bd08e62 (diff)
Merge pull request #1096 from mono/active-window
[AlertDialogBackend] Ensures parent is set using the active window if there are not any window specified
-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];
}