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
This commit is contained in:
Robert Roebling
2009-01-17 21:42:17 +00:00
parent 94929e7b60
commit 80e8b5de77

View File

@@ -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);