Skip to content

Commit

Permalink
Avoid re-focusing if control already has focus (#495)
Browse files Browse the repository at this point in the history
Re-focusing interferes with certain operations such
as resizing windows in Remote Desktop
  • Loading branch information
jpassing authored May 14, 2021
1 parent 2a6f895 commit 5410a0a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ protected override void WndProc(ref Message m)
//
// Cf. https://www.codeproject.com/Tips/109917/Fix-the-focus-issue-on-RDP-Client-from-the-AxInter
//
if (m.Msg == WM_MOUSEACTIVATE)
// NB. Only do this when the control does not have focus yet,
// otherwise we're interfering with operations such as dragging
// or resizing windows.
//
if (!this.ContainsFocus && m.Msg == WM_MOUSEACTIVATE)
{
this.Focus();
}
Expand Down

0 comments on commit 5410a0a

Please sign in to comment.