From 2e9c0c010a375156eb72eaa1e2e4efcbb7ecf06b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 Apr 2007 23:06:42 +0000 Subject: [PATCH] don't skip the scroll position validity check in CalcScrollInc() if m_[xy]ScrollPixelsPerLine is NULL, this resulted in problems mentioned in patch 1696082 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 55 +++++++++++++++------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index d46d0a017c..7db540e792 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -613,49 +613,36 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) if (orient == wxHORIZONTAL) { - if (m_xScrollPixelsPerLine > 0) + if ( m_xScrollPosition + nScrollInc < 0 ) { - if ( m_xScrollPosition + nScrollInc < 0 ) - { - // As -ve as we can go - nScrollInc = -m_xScrollPosition; - } - else // check for the other bound + // As -ve as we can go + nScrollInc = -m_xScrollPosition; + } + else // check for the other bound + { + const int posMax = m_xScrollLines - m_xScrollLinesPerPage; + if ( m_xScrollPosition + nScrollInc > posMax ) { - const int posMax = m_xScrollLines - m_xScrollLinesPerPage; - if ( m_xScrollPosition + nScrollInc > posMax ) - { - // As +ve as we can go - nScrollInc = posMax - m_xScrollPosition; - } + // As +ve as we can go + nScrollInc = posMax - m_xScrollPosition; } } - else - m_targetWindow->Refresh(true, GetScrollRect()); } - else + else // wxVERTICAL { - if ( m_yScrollPixelsPerLine > 0 ) + if ( m_yScrollPosition + nScrollInc < 0 ) { - if ( m_yScrollPosition + nScrollInc < 0 ) - { - // As -ve as we can go - nScrollInc = -m_yScrollPosition; - } - else // check for the other bound - { - const int posMax = m_yScrollLines - m_yScrollLinesPerPage; - if ( m_yScrollPosition + nScrollInc > posMax ) - { - // As +ve as we can go - nScrollInc = posMax - m_yScrollPosition; - } - } + // As -ve as we can go + nScrollInc = -m_yScrollPosition; } - else + else // check for the other bound { - // VZ: why do we do this? (FIXME) - m_targetWindow->Refresh(true, GetScrollRect()); + const int posMax = m_yScrollLines - m_yScrollLinesPerPage; + if ( m_yScrollPosition + nScrollInc > posMax ) + { + // As +ve as we can go + nScrollInc = posMax - m_yScrollPosition; + } } } -- 2.45.2