X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4513b23896c274eb859e0856d7e391b04f77819..1e52188741389278cd99abf79218162c87024ba3:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index bf9a58d3fa..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 @@ -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