Skip to content

Commit

Permalink
Merge pull request #2687 from cwensley/curtis/wpf-avoid-showing-windo…
Browse files Browse the repository at this point in the history
…w-before-loaded

Form visibility fixes
  • Loading branch information
cwensley authored Oct 1, 2024
2 parents d368424 + d2048e4 commit 156c07e
Show file tree
Hide file tree
Showing 14 changed files with 975 additions and 823 deletions.
15 changes: 15 additions & 0 deletions src/Eto.Gtk/Forms/FormHandler.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Eto.GtkSharp.CustomControls;

namespace Eto.GtkSharp.Forms
{
public class FormHandler : GtkWindow<Gtk.Window, Form, Form.ICallback>, Form.IHandler
Expand Down Expand Up @@ -55,5 +57,18 @@ public bool CanFocus
get { return Widget.Properties.Get<bool>(CanFocus_Key, true); }
set { Widget.Properties.Set(CanFocus_Key, value, () => Control.AcceptFocus = value, true); }
}

public override bool Visible
{
get => base.Visible;
set
{
base.Visible = value;
if (ShowActivated && value)
{
Focus();
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Eto.Gtk/Forms/GtkWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ public Screen Screen
}
}

protected override void GrabFocus() => Control.Present();
protected override void GrabFocus() => Control.GetWindow().Focus(0);

public void BringToFront()
{
Expand Down
Loading

0 comments on commit 156c07e

Please sign in to comment.