From b5a78fbac6b1cfd56861d123a3e5617ac2854c96 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 12 Apr 2021 18:09:37 +0200 Subject: [PATCH] Also make SetMinSize() after wxSizer::Fit() work correctly This fixes a problem similar to that fixed in the previous commit but for SetMinSize(), which was also ignored if done after calling wxSizer::Fit() and before showing the window, as the explicitly set min size was also overwritten by the pending min size computed from the client size corresponding to the sizer fitting size. The fix is similar too: just invalidate the pending minimum size if SetMinSize() is called. --- include/wx/gtk/toplevel.h | 2 ++ src/gtk/toplevel.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index ac2e27a7fd..88abfd03cf 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -141,6 +141,8 @@ public: #ifdef __WXGTK3__ void GTKUpdateClientSizeIfNecessary(); + virtual void SetMinSize(const wxSize& minSize) wxOVERRIDE; + virtual void WXSetInitialFittingClientSize(int flags) wxOVERRIDE; private: diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index d5cf3268e3..ec2b6e5b51 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -1568,6 +1568,14 @@ void wxTopLevelWindowGTK::GTKUpdateClientSizeIfNecessary() } } +void wxTopLevelWindowGTK::SetMinSize(const wxSize& minSize) +{ + wxTopLevelWindowBase::SetMinSize(minSize); + + // Explicitly set minimum size should override the pending size, if any. + m_pendingFittingClientSizeFlags &= ~wxSIZE_SET_MIN; +} + void wxTopLevelWindowGTK::WXSetInitialFittingClientSize(int flags) { // In any case, update the size immediately.