Don't overwrite explicitly set size with pending client size

Calls to SetSize() were ignored in wxGTK if they happened after calling
wxSizer::Fit() since the changes of f655a52fba (Allow wxSizer::Fit() to
work properly when called from TLW ctor on GTK3, 2020-04-20) because we
overwrote the explicitly set size with the client size computed earlier
by the sizer.

Don't do this by explicitly forgetting the client size we were going to
set when SetSize() is called.

Closes #19134.
This commit is contained in:
Vadim Zeitlin
2021-04-12 17:58:31 +02:00
parent fd7386ed83
commit 645e1d2fd0

View File

@@ -1280,6 +1280,19 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
m_deferShowAllowed = true;
m_useCachedClientSize = false;
#ifdef __WXGTK3__
// Reset pending client size, it is not relevant any more and shouldn't
// be set when the window is shown, as we don't want it to replace the
// size explicitly specified here. Note that we do still want to set
// the minimum client size, as increasing the total size shouldn't
// allow shrinking the frame beyond its minimum fitting size.
//
// Also note that if we're called from WXSetInitialFittingClientSize()
// itself, this will be overwritten again with the pending flags when
// we return.
m_pendingFittingClientSizeFlags &= ~wxSIZE_SET_CURRENT;
#endif // __WXGTK3__
int w, h;
GTKDoGetSize(&w, &h);
gtk_window_resize(GTK_WINDOW(m_widget), w, h);