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

Commit

Permalink
Fix 988924: Some commands (save, undo) do not work if editor is detat…
Browse files Browse the repository at this point in the history
…ched 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....
  • Loading branch information
DavidKarlas authored and sandyarmstrong committed Nov 7, 2019
1 parent c2a65dd commit 0c62a9a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,8 @@ Windows.GtkWPFWidget GetFocusedWpfWidget ()
Gtk.Widget GetFocusedChild (Control widget)
{
Gtk.Container container;

if (widget?.nativeWidget is AppKit.NSWindow window)
widget = Mac.GtkMacInterop.GetGtkWindow (window)?.Child;
do {
container = widget?.nativeWidget is Gtk.Container ? widget.GetNativeWidget<Gtk.Container> () : null;
if (container != null) {
Expand All @@ -2376,7 +2377,7 @@ Gtk.Widget GetFocusedChild (Control widget)
}
} while (container != null);

return widget.nativeWidget is Gtk.Widget ? widget : null;
return widget?.nativeWidget is Gtk.Widget ? widget : null;
}

#if MAC
Expand Down

0 comments on commit 0c62a9a

Please sign in to comment.