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

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs28
1 files changed, 13 insertions, 15 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
index f2bafbd922..c1be68eb9e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
@@ -2304,10 +2304,18 @@ namespace MonoDevelop.Components.Commands
Window GetActiveWindow (Window win)
{
- Gtk.Window [] wins = Gtk.Window.ListToplevels ();
-
- bool hasFocus = false;
bool lastFocusedExists = lastFocused == null;
+ bool hasFocus = false;
+#if MAC
+ var nsWindow = AppKit.NSApplication.SharedApplication.KeyWindow;
+ hasFocus = nsWindow != null;
+ if (hasFocus) {
+ lastFocusedExists |= lastFocused?.nativeWidget == nsWindow;
+ lastFocused = win = nsWindow;
+ } else {
+#endif
+
+ Gtk.Window [] wins = Gtk.Window.ListToplevels ();
Gtk.Window newFocused = null;
foreach (Gtk.Window w in wins) {
if (w.Visible) {
@@ -2324,18 +2332,9 @@ namespace MonoDevelop.Components.Commands
}
}
+ lastFocused = newFocused;
#if MAC
- if (!hasFocus) {
- var nsWindow = AppKit.NSApplication.SharedApplication.KeyWindow;
- hasFocus = nsWindow != null;
- if (hasFocus) {
- lastFocused = win = nsWindow;
- }
- } else {
- lastFocused = newFocused;
}
-#else
- lastFocused = newFocused;
#endif
UpdateAppFocusStatus (hasFocus, lastFocusedExists);
@@ -2343,8 +2342,7 @@ namespace MonoDevelop.Components.Commands
if (win != null && win.IsRealized) {
RegisterTopWindow (win);
return win;
- }
- else
+ } else
return null;
}