X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/44f4f7dda0e604608f0344d72a88c3920f69d035..b89e528d7066918515e6ad7f77ff4637564ef25e:/src/common/containr.cpp diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 53d4e01348..fbd3ea33d2 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -47,14 +47,20 @@ // wxControlContainerBase // ---------------------------------------------------------------------------- -void wxControlContainerBase::SetCanFocus(bool acceptsFocus) +bool wxControlContainerBase::UpdateCanFocusChildren() { - if ( acceptsFocus == m_acceptsFocus ) - return; + const bool acceptsFocusChildren = HasAnyFocusableChildren(); + if ( acceptsFocusChildren != m_acceptsFocusChildren ) + { + m_acceptsFocusChildren = acceptsFocusChildren; - m_acceptsFocus = acceptsFocus; + // In the ports where it does something non trivial, the parent window + // should only be focusable if it doesn't have any focusable children + // (e.g. native focus handling in wxGTK totally breaks down otherwise). + m_winParent->SetCanFocus(m_acceptsFocusSelf && !m_acceptsFocusChildren); + } - m_winParent->SetCanFocus(m_acceptsFocus); + return m_acceptsFocusChildren; } bool wxControlContainerBase::HasAnyFocusableChildren() const