Skip to content

Commit

Permalink
Wpf: Don't activate FloatingForm when setting Visible manually
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensley committed Mar 25, 2024
1 parent 868ffe8 commit c5763ca
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 c5763ca

Please sign in to comment.