Don't recurse upwards when updating pending focus in wxMSW
This is unnecessary, we only need to update the pending focus in the immediate parent window to prevent a wrong radio button from being focused (and hence selected) when it regains focus, there is no good reason at all to interfere with the focus in the grandparent (and higher) windows. Doing this was not only useless, but actually harmful, as it overrode explicit calls to SetFocus() in the user code, so just stop doing it. This also allows to avoid having 2 functions related to this and keep just a single virtual WXSetPendingFocus() one. Closes #18653.
This commit is contained in:
@@ -1024,25 +1024,6 @@ void wxWindowMSW::MSWUpdateUIState(int action, int state)
|
||||
::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0);
|
||||
}
|
||||
|
||||
void wxWindowMSW::WXSetPendingFocus(wxWindow* win)
|
||||
{
|
||||
wxWindow * const focus = FindFocus();
|
||||
|
||||
for ( wxWindow* parent = this; parent; parent = parent->GetParent() )
|
||||
{
|
||||
// We shouldn't overwrite the pending focus if the window has the focus
|
||||
// currently, as this would make its state inconsistent. And this would
|
||||
// be useless anyhow, as we only remember pending focus in order to
|
||||
// restore it properly when the window gets the focus back -- which is
|
||||
// unnecessary if it has the focus already.
|
||||
if ( !parent->IsDescendant(focus) )
|
||||
parent->WXDoUpdatePendingFocus(win);
|
||||
|
||||
if ( parent->IsTopLevel() )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// scrolling stuff
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user