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:
authorVsevolod Kukol <sevoku@microsoft.com>2020-01-22 18:28:45 +0300
committerGitHub <noreply@github.com>2020-01-22 18:28:45 +0300
commit93cd83393834248435a578fd2d97721cdd6ecd8d (patch)
tree9a6775b42e757a569177ad81590f0d4d0989ab42
parent2be789e94e75d152c0a611667d34635ebd88c5de (diff)
parent205129baafd79712819f2ed4be4f9a6d886feacb (diff)
Merge pull request #9533 from mono/fix-routing-cocoa
Fixes CommandHandler routing in native widgets
-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;
}