mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Decrease the size of non-resizeable TLWs on DPI change
We avoid decreasing the size of the TLW on DPI change to preserve the user-set size, but this logic doesn't apply to non-resizeable windows as the user couldn't have changed their size, so do shrink them. Closes #26485.
This commit is contained in:
+11
-1
@@ -311,7 +311,17 @@ bool wxNonOwnedWindow::HandleDPIChange(const wxSize& newDPI, const wxRect& newRe
|
||||
{
|
||||
const wxSize minSize = ClientToWindowSize(sizer->GetMinSize());
|
||||
wxSize diff = minSize - newRect.GetSize();
|
||||
diff.IncTo(wxSize(0, 0));
|
||||
|
||||
// We don't want to shrink the window as if the user had increased
|
||||
// it beyond its minimum size, we should not make it smaller again
|
||||
// just because the DPI has changed, but if the window is not
|
||||
// resizeable, then we do want to make it exactly of its minimum
|
||||
// size because the user couldn't resize it and making it bigger
|
||||
// than needed would just show unnecessary extra empty space.
|
||||
if ( HasFlag(wxRESIZE_BORDER) )
|
||||
{
|
||||
diff.IncTo(wxSize(0, 0));
|
||||
}
|
||||
|
||||
// Use wxRect::Inflate() to ensure that the center of the bigger
|
||||
// rectangle is at the same position as the center of the proposed
|
||||
|
||||
Reference in New Issue
Block a user