X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/29e1398fa035b277569c4514deb622e9f1ddcf40..3f8cdda4851796e5f5f5bcd82d9e867a30581a6f:/src/gtk/scrolwin.cpp 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);