X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/44f4f7dda0e604608f0344d72a88c3920f69d035..2e6bfeb9035233b2889af03f7846d2c77125efb7:/src/common/containr.cpp diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 53d4e01348..9de060cdda 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 @@ -181,7 +187,7 @@ void wxControlContainer::SetLastFocus(wxWindow *win) // within the same group. Used by wxSetFocusToChild on wxMSW // -------------------------------------------------------------------- -#if defined(__WXMSW__) && wxUSE_RADIOBTN +#if wxUSE_RADIOBTN wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn) {