Merge branch 'context-menu-focus-returning' of git://github.com/stefnotch/FlaxEngine into stefnotch-context-menu-focus-returning

This commit is contained in:
Wojtek Figat
2021-01-03 23:36:08 +01:00

View File

@@ -45,6 +45,7 @@ namespace FlaxEditor.GUI.ContextMenu
private bool _isSubMenu;
private ContextMenuBase _childCM;
private Window _window;
private Control _previouslyFocused;
/// <summary>
/// Returns true if context menu is opened
@@ -185,6 +186,7 @@ namespace FlaxEditor.GUI.ContextMenu
return;
_window.Show();
PerformLayout();
_previouslyFocused = parentWin.FocusedControl;
Focus();
OnShow();
}
@@ -221,6 +223,10 @@ namespace FlaxEditor.GUI.ContextMenu
_parentCM = null;
}
// Return focus
_previouslyFocused?.RootWindow?.Focus();
_previouslyFocused?.Focus();
// Hide
Visible = false;
OnHide();