diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2019-02-21 18:03:28 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-02-21 18:04:48 +0300 |
commit | 72d410b447bc317e1a48c7b2c9f7c23df2fd56bd (patch) | |
tree | f29c9b6ac2cee8ce2dfa5b34e026c2d715f12e02 | |
parent | 0a5c319faafcebd70ccbafa814a2988b4caa33a2 (diff) |
[Ide] Focus the active document only once after activation and only if it is inside the active workbench
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs index a2e7fa3e79..eb7e0eb555 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs @@ -262,9 +262,9 @@ namespace MonoDevelop.Ide.Gui { if (subViewToolbar != null) subViewToolbar.Tabs [subViewToolbar.ActiveTab].Activate (); - ActiveViewContent.GrabFocus (); + ScheduleContentGrabFocus (); } - + public void SelectWindow () { var window = tabControl.Toplevel as Gtk.Window; @@ -291,8 +291,21 @@ namespace MonoDevelop.Ide.Gui // Focus the tab in the next iteration since presenting the window may take some time Application.Invoke ((o, args) => { DockNotebook.ActiveNotebook = tabControl; - ActiveViewContent.GrabFocus (); }); + ScheduleContentGrabFocus (); + } + + bool contentGrabFocusScheduled; + void ScheduleContentGrabFocus () + { + if (contentGrabFocusScheduled) + return; + Application.Invoke ((o, args) => { + contentGrabFocusScheduled = false; + if (workbench.ActiveWorkbenchWindow == this) + ActiveViewContent.GrabFocus (); + }); + contentGrabFocusScheduled = true; } public bool CanMoveToNextNotebook () |