From: Robert Roebling <robert@roebling.de> Date: Sat, 17 Jan 2009 21:42:17 +0000 (+0000) Subject: Fix scrolled window bug when reducing the virtual size when being scrolled maximally... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/80e8b5de7722793fc47e509913193dfe159adb55 Fix scrolled window bug when reducing the virtual size when being scrolled maximally down corrupted the display due to excess scrolling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index ef9dfd797c..48159d41c8 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -41,12 +41,6 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int xPos, int yPos, bool noRefresh) { - int xs, ys; - GetViewStart(& xs, & ys); - - int old_x = m_xScrollPixelsPerLine * xs; - int old_y = m_yScrollPixelsPerLine * ys; - m_xScrollPixelsPerLine = pixelsPerUnitX; m_yScrollPixelsPerLine = pixelsPerUnitY; @@ -64,6 +58,13 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord, h ? h : wxDefaultCoord); + // Query view start after m_targetWindow->SetVirtualSize(...) since + // that call can change the current=old scrolling position! + int xs, ys; + GetViewStart(& xs, & ys); + int old_x = m_xScrollPixelsPerLine * xs; + int old_y = m_yScrollPixelsPerLine * ys; + // If the target is not the same as the window with the scrollbars, // then we need to update the scrollbars here, since they won't have // been updated by SetVirtualSize(). @@ -110,7 +111,7 @@ void wxScrollHelper::DoAdjustScrollbar(GtkRange* range, GtkAdjustment* adj = range->adjustment; adj->step_increment = 1; - adj->page_increment = + adj->page_increment = adj->page_size = page_size; gtk_range_set_range(range, 0, upper);