From: Vadim Zeitlin Date: Mon, 28 Nov 2011 19:15:57 +0000 (+0000) Subject: Correct HasFocus() to work with subwindows of a composite control. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/202388d3bc9bbe1d4e53c5292da767a6764b7f39 Correct HasFocus() to work with subwindows of a composite control. When a subwindow (i.e. one that overrides GetMainWindowOfCompositeControl() to return a parent window) has focus, HasFocus() should return true for it too, in addition to returning true for the main window. This completes the fix of r69788. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 16f1ed9da8..969ace7bae 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -3328,7 +3328,9 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move) bool wxWindowBase::HasFocus() const { - return FindFocus() == this; + wxWindowBase* const win = DoFindFocus(); + return win && + (this == win || this == win->GetMainWindowOfCompositeControl()); } // ----------------------------------------------------------------------------