]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct HasFocus() to work with subwindows of a composite control.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 28 Nov 2011 19:15:57 +0000 (19:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 28 Nov 2011 19:15:57 +0000 (19:15 +0000)
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

src/common/wincmn.cpp

index 16f1ed9da868b019c781afc05aba8295f4bba0fe..969ace7bae41a319f58e6c75d393b7f86dd16339 100644 (file)
@@ -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());
 }
 
 // ----------------------------------------------------------------------------