From 645e1d2fd0eaaa1db4a3ae4590d303784584aad2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 12 Apr 2021 17:58:31 +0200 Subject: [PATCH] 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. --- src/gtk/toplevel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index e68cf9de0d..d5cf3268e3 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -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);