Debugger: Fixed debugger window being brought to front after tooltip closes even though it was in the background before the tooltip was shown

This commit is contained in:
Sour 2018-07-09 22:28:08 -04:00
parent 2b41a15941
commit e2b9a7aa8e
3 changed files with 15 additions and 2 deletions

View file

@ -59,9 +59,12 @@ namespace Mesen.GUI.Debugger
public void Close()
{
if(_codeTooltip != null) {
bool restoreFocus = _codeTooltip.NeedRestoreFocus;
_codeTooltip.Close();
if(restoreFocus) {
_owner.Focus();
}
_codeTooltip = null;
_owner.Focus();
}
}

View file

@ -211,12 +211,15 @@ namespace Mesen.GUI.Debugger.Controls
{
base.OnMouseLeave(e);
if(_codeTooltip != null) {
bool restoreFocus = _codeTooltip.NeedRestoreFocus;
_codeTooltip.Close();
if(restoreFocus) {
this.Parent.Focus();
}
_codeTooltip = null;
}
_lastPreviewScrollPosition = -1;
_tmrScroll.Stop();
this.Parent.Focus();
}
private int HighlightHeight { get { return Math.Max(8, (int)(((float)this.VisibleLineCount / this.Maximum) * this.Height)); } }

View file

@ -14,6 +14,7 @@ namespace Mesen.GUI.Debugger
{
protected Form _parentForm;
private Point _requestedLocation;
private bool _parentContainedFocus = false;
protected override void OnLoad(EventArgs e)
{
@ -31,11 +32,17 @@ namespace Mesen.GUI.Debugger
}
}
public bool NeedRestoreFocus
{
get { return _parentContainedFocus; }
}
public void SetFormLocation(Point screenLocation, Control focusTarget)
{
_requestedLocation = _parentForm.PointToClient(screenLocation);
if(!this.Visible) {
this._parentContainedFocus = focusTarget.ContainsFocus;
this.Location = _requestedLocation;
this.Show();
} else {