Fix updating saved splitter position on DPI change

While the current and minimum positions were updated, the saved last
split position was not, so unsplitting the splitter, changing the DPI
and splitting it again wouldn't use the correct position for the new
DPI.

Also rescale m_requestedSashPosition if it's valid even if it's not
clear whether this can happen or not.
This commit is contained in:
Vadim Zeitlin
2026-09-14 14:03:23 +02:00
parent 8a78656005
commit 5a2a673d60
+7
View File
@@ -512,6 +512,13 @@ void wxSplitterWindow::OnDPIChanged(wxDPIChangedEvent& event)
m_minimumPaneSize = event.ScaleX(m_minimumPaneSize);
m_sashPosition = event.ScaleX(m_sashPosition);
m_lastSize = event.Scale(m_lastSize);
// Any saved or pending positions need to be updated too.
m_lastSplitPosition = event.Scale(m_lastSplitPosition);
// But this one should only be scaled if it is really valid.
if ( m_requestedSashPosition != INT_MAX )
m_requestedSashPosition = event.ScaleX(m_requestedSashPosition);
#endif // !wxHAS_DPI_INDEPENDENT_PIXELS
event.Skip();