- // it might happen that the window got reparented...
- if ( m_winLastFocused->GetParent() == this )
+ // It might happen that the window got reparented or no longer
+ // accepts the focus.
+ if ((m_winLastFocused->GetParent() == this) &&
+ (m_winLastFocused->AcceptsFocus()))