X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4b3163294c68097a196dcb51f1a0e1475f9a3f57..f284605f65f6f957c90452b574f4131079819b53:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 46b409c65d..8dab9a85f1 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -44,6 +44,7 @@ #include "wx/timer.h" #endif #include "wx/sizer.h" +#include "wx/recguard.h" #ifdef __WXMSW__ #include // for DLGC_WANTARROWS @@ -621,6 +622,19 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) // Adjust the scrollbars - new version. void wxScrollHelper::AdjustScrollbars() { + static wxRecursionGuardFlag s_flagReentrancy; + wxRecursionGuard guard(s_flagReentrancy); + if ( guard.IsInside() ) + { + // don't reenter AdjustScrollbars() while another call to + // AdjustScrollbars() is in progress because this may lead to calling + // ScrollWindow() twice and this can really happen under MSW if + // SetScrollbar() call below adds or removes the scrollbar which + // changes the window size and hence results in another + // AdjustScrollbars() call + return; + } + #ifdef __WXMAC__ m_targetWindow->Update(); #endif @@ -722,7 +736,7 @@ void wxScrollHelper::AdjustScrollbars() oldh = h; GetTargetSize( &w, &h ); - } while ( w != oldw && h != oldh ); + } while ( w != oldw || h != oldh ); #ifdef __WXMOTIF__ // Sorry, some Motif-specific code to implement a backing pixmap @@ -1289,24 +1303,6 @@ wxGenericScrolledWindow::MSWWindowProc(WXUINT nMsg, #endif // __WXMSW__ -#if WXWIN_COMPATIBILITY - -void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const -{ - *x_page = GetScrollPageSize(wxHORIZONTAL); - *y_page = GetScrollPageSize(wxVERTICAL); -} - -void wxGenericScrolledWindow::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const -{ - if ( xx ) - *xx = (float)(x + m_xScrollPosition * m_xScrollPixelsPerLine); - if ( yy ) - *yy = (float)(y + m_yScrollPosition * m_yScrollPixelsPerLine); -} - -#endif // WXWIN_COMPATIBILITY - #endif // !wxGTK // vi:sts=4:sw=4:et