Apply workaround to all sibling children, not just the first one

This is important as while giving debug message is optional (and might
even be not ideal, see the grandparent commit description), we do need
to call MSWDisableComposited() when all sibling children already exist
as otherwise it wouldn't reset WS_EX_COMPOSITED for them -- and many
windows, such as wxOwnerDrawnComboBox are not drawn correctly if they
have WS_EX_COMPOSITED and overlap a sibling window (worse, this somehow
seems to break the redrawing of the entire TLW, with even the controls
completely outside of the static box being affected, see #23239).

This commit is best viewed ignoring whitespace-only changes.
This commit is contained in:
Vadim Zeitlin 2023-02-20 16:55:04 +00:00
parent ce75f27bf9
commit 61c28b35e1

View file

@ -2832,23 +2832,21 @@ bool wxStaticBoxSizer::CheckIfNonBoxChild(wxWindow* win) const
wxSizerItem* wxStaticBoxSizer::DoInsert(size_t index, wxSizerItem* item)
{
// Check if we have any non-box children unless we already know that we do.
if ( !m_hasNonBoxChildren )
if ( wxWindow* const win = item->GetWindow() )
{
if ( wxWindow* const win = item->GetWindow() )
{
// We can check immediately if we have any non-box children and
// it's better to do it here, for example to allow putting a
// breakpoint on wxLogDebug() message above and immediately seeing
// where the item is inserted from, if it's not clear otherwise.
m_hasNonBoxChildren = CheckIfNonBoxChild(win);
}
else if ( item->IsSizer() )
{
// We can't check immediately as elements can be added to the child
// sizer after adding it to this one, so schedule a check for later.
// We can check immediately if we have any non-box children and
// it's better to do it here, for example to allow putting a
// breakpoint on wxLogDebug() message above and immediately seeing
// where the item is inserted from, if it's not clear otherwise.
if ( CheckIfNonBoxChild(win) )
m_hasNonBoxChildren = 1;
}
else if ( item->IsSizer() )
{
// We can't check immediately as elements can be added to the child
// sizer after adding it to this one, so schedule a check for later.
if ( !m_hasNonBoxChildren )
m_hasNonBoxChildren = -1;
}
}
return wxBoxSizer::DoInsert(index, item);