Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 0c62a9a

Browse files
DavidKarlassandyarmstrong
authored andcommitted
Fix 988924: Some commands (save, undo) do not work if editor is detatched from IDE into its own window
Problem is that when command comes in, it first goes to CocoaTextViewControl and then up NSView treeview, problem starts when migrating to GTK treeview because GtkNSViewHost is not set as it should be, after debugging why this happens it appears that `GetFocusedChild` method wasn't returning `GtkNSViewHost` as expected, upon further debugging it turns out thats because logic of drilling down GTK treeview doesn't work because `GetFocusedChild` parameter is `NSWindow` instead of `GtkWindow`. So fix is to convert `NSWindow` to `GtkWindow` and now everything works as expected. Reason we are getting `NSWindow` instead of `GtkWindow` is somewhere in `GetActiveWindow` method, but I'm not sure if its bug or not....
1 parent c2a65dd commit 0c62a9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,8 @@ Windows.GtkWPFWidget GetFocusedWpfWidget ()
23642364
Gtk.Widget GetFocusedChild (Control widget)
23652365
{
23662366
Gtk.Container container;
2367-
2367+
if (widget?.nativeWidget is AppKit.NSWindow window)
2368+
widget = Mac.GtkMacInterop.GetGtkWindow (window)?.Child;
23682369
do {
23692370
container = widget?.nativeWidget is Gtk.Container ? widget.GetNativeWidget<Gtk.Container> () : null;
23702371
if (container != null) {
@@ -2376,7 +2377,7 @@ Gtk.Widget GetFocusedChild (Control widget)
23762377
}
23772378
} while (container != null);
23782379

2379-
return widget.nativeWidget is Gtk.Widget ? widget : null;
2380+
return widget?.nativeWidget is Gtk.Widget ? widget : null;
23802381
}
23812382

23822383
#if MAC

0 commit comments

Comments
 (0)