object GetActiveWidget (Gtk.Window win)
{
win = GetActiveWindow (win);
Gtk.Widget widget = win;
if (win != null) {
#if MAC
var nw = MonoDevelop.Components.Mac.GtkMacInterop.GetNSWindow (win);
if (nw != null) {
var v = nw.FirstResponder as AppKit.NSView;
if (v != null && !IsRootGdkQuartzView (v)) {
if (IsEmbeddedNSView (v))
// FIXME: since there is no way to get the parent GTK widget of an embedded NSView,
// here we return a ICommandDelegatorRouter object that will cause the command route
// to continue with the active gtk widget once the NSView hierarchy has been inspected.
return new NSViewCommandRouter { ActiveView = v, ParentWidget = GetFocusedChild (widget) };
return v;
}
}
#endif
widget = GetFocusedChild (widget);
}
if (widget != lastActiveWidget) {
if (ActiveWidgetChanged != null)
ActiveWidgetChanged (this, new ActiveWidgetEventArgs () { OldActiveWidget = lastActiveWidget, NewActiveWidget = widget });
lastActiveWidget = widget;
}
return widget;
}