Restrict the new size after DPI change to the display size

wxSizer::GetMinSize() can return a size bigger than the display size,
but we never want to use such size for the window, so ensure that it
fits the display client area.

This also ensures that the window doesn't become bigger than its max
size.
This commit is contained in:
Vadim Zeitlin
2026-06-16 20:00:59 +02:00
parent 0ebc0e51ec
commit 8386a98409
+1 -1
View File
@@ -318,7 +318,7 @@ bool wxNonOwnedWindow::HandleDPIChange(const wxSize& newDPI, const wxRect& newRe
wxRect actualNewRect = newRect;
if ( wxSizer* sizer = GetSizer() )
{
const wxSize minSize = ClientToWindowSize(sizer->GetMinSize());
const wxSize minSize = sizer->ComputeFittingClientSize(this);
wxSize diff = minSize - newRect.GetSize();
// We don't want to shrink the window as if the user had increased