public void SelectWindow() { var window = tabControl.Toplevel as Gtk.Window; if (window != null) { if (window is DockWindow) { DesktopService.GrabDesktopFocus(window); } // Focusing the main window so hide all the autohide pads workbench.DockFrame.MinimizeAllAutohidden(); #if MAC AppKit.NSWindow nswindow = MonoDevelop.Components.Mac.GtkMacInterop.GetNSWindow(window); if (nswindow != null) { nswindow.MakeFirstResponder(nswindow.ContentView); nswindow.MakeKeyAndOrderFront(nswindow); } #endif } // The tab change must be done now to ensure that the content is created // before exiting this method. tabControl.CurrentTabIndex = tab.Index; // Focus the tab in the next iteration since presenting the window may take some time Application.Invoke((o, args) => { DockNotebook.ActiveNotebook = tabControl; ActiveViewContent.GrabFocus(); }); }
void ScheduleContentGrabFocus() { if (contentGrabFocusScheduled) { return; } Application.Invoke((o, args) => { contentGrabFocusScheduled = false; if (workbench.ActiveWorkbenchWindow == this) { ActiveViewContent.GrabFocus(); } }); contentGrabFocusScheduled = true; }