Skip to content

Commit

Permalink
Mac: Prevent GotFocus/LostFocus firing twice when the form is the Fir…
Browse files Browse the repository at this point in the history
…stReponder
  • Loading branch information
cwensley committed Apr 24, 2024
1 parent d2010b2 commit c312ea1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Eto.Mac/Forms/MacWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static void HandleGotFocus(object sender, EventArgs e)
if (handler == null)
return;
handler.Callback.OnGotFocus(handler.Widget, EventArgs.Empty);
if (GetHandler(handler.Control.FirstResponder) is IMacViewHandler ctlHandler)
if (GetHandler(handler.Control.FirstResponder) is IMacViewHandler ctlHandler && ctlHandler != handler)
{
ctlHandler.Callback.OnGotFocus(ctlHandler.Widget, EventArgs.Empty);
}
Expand All @@ -354,7 +354,7 @@ static void HandleLostFocus(object sender, EventArgs e)
if (handler == null)
return;

if (GetHandler(handler.Control.FirstResponder) is IMacViewHandler ctlHandler)
if (GetHandler(handler.Control.FirstResponder) is IMacViewHandler ctlHandler && ctlHandler != handler)
{
ctlHandler.Callback.OnLostFocus(ctlHandler.Widget, EventArgs.Empty);
}
Expand Down

0 comments on commit c312ea1

Please sign in to comment.