diff options
author | Jose Medrano <jose.medrano@microsoft.com> | 2019-03-28 16:14:23 +0300 |
---|---|---|
committer | xamarin-jenkins <jo.shields+jenkins@xamarin.com> | 2019-03-29 16:04:35 +0300 |
commit | 696b66dc95a258711778bda1bbdd1d22e4a76e99 (patch) | |
tree | 11a6910c1e37f6cb1ad61c81769d375492d754a1 /main/src/addins/MacPlatform | |
parent | 0532e0acfddb17a86359237a585f4937bbc03889 (diff) |
[GetToCode] Fixes current GetFocusedTopLevelWindow when dock windows are focused Fixes VSTS #827074 - Modal NSPanel in Application Output https://devdiv.visualstudio.com/DevDiv/_queries/edit/827074/?triage=true
Diffstat (limited to 'main/src/addins/MacPlatform')
-rw-r--r-- | main/src/addins/MacPlatform/MacPlatform.cs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index 6dfb61f82f..7dfdbb217f 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -998,9 +998,34 @@ namespace MonoDevelop.MacIntegration return NSApplication.SharedApplication.ModalWindow ?? NSApplication.SharedApplication.KeyWindow ?? NSApplication.SharedApplication.MainWindow; } + bool HasAnyDockWindowFocused () + { + foreach (var window in Gtk.Window.ListToplevels ()) { + if (!window.HasToplevelFocus) { + continue; + } + if (window is Components.Docking.DockFloatingWindow floatingWindow) { + return true; + } + if (window is IdeWindow ideWindow && ideWindow.Child is Components.Docking.AutoHideBox) { + return true; + } + } + return false; + } + public override Window GetFocusedTopLevelWindow () { - return NSApplication.SharedApplication.KeyWindow; + if (NSApplication.SharedApplication.KeyWindow != null) { + if (IdeApp.Workbench.RootWindow.Visible) { + //if is a docking window then return the current root window + if (HasAnyDockWindowFocused ()) { + return MessageService.RootWindow; + } + } + return NSApplication.SharedApplication.KeyWindow; + } + return null; } public override void FocusWindow (Window window) |