Skip to content

Commit

Permalink
Merge pull request #2636 from cwensley/curtis/wpf-floatingform-visible
Browse files Browse the repository at this point in the history
Wpf: Don't activate FloatingForm when setting Visible manually
  • Loading branch information
cwensley authored Mar 25, 2024
2 parents 0e1f057 + c5763ca commit ce9a417
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Eto.Wpf/Forms/FloatingFormHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override void OnUnLoad(EventArgs e)

private void Application_IsActiveChanged(object sender, EventArgs e)
{
SetVisibility();
SetVisibility(true);
}

public override bool Visible
Expand All @@ -41,7 +41,7 @@ public override bool Visible
set
{
Widget.Properties.Set(Visible_Key, value, true);
SetVisibility();
SetVisibility(false);
}
}

Expand All @@ -51,7 +51,7 @@ public override void Show()
base.Show();
}

void SetVisibility()
void SetVisibility(bool setActive)
{
var currentlyVisible = base.Visible;
var isVisible = Application.Instance.IsActive && Visible;
Expand All @@ -66,13 +66,15 @@ void SetVisibility()
}
base.Visible = isVisible;
}
else
else if (setActive)
{
var oldShowActivated = Control.ShowActivated;
Control.ShowActivated = _wasActive;
base.Visible = isVisible;
Control.ShowActivated = oldShowActivated;
}
else
base.Visible = isVisible;
}
}
}

0 comments on commit ce9a417

Please sign in to comment.