X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/066f1b7a9580fc6c487efa753d61e3683de61407..365796b153d710b08a03b92de241574d01c498d7:/src/generic/scrlwing.cpp?ds=sidebyside diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 726b6c1935..bce06f0b5e 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -18,7 +18,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "genscrolwin.h" #endif @@ -40,8 +40,11 @@ #include "wx/scrolwin.h" #include "wx/panel.h" +#if wxUSE_TIMER #include "wx/timer.h" +#endif #include "wx/sizer.h" +#include "wx/recguard.h" #ifdef __WXMSW__ #include // for DLGC_WANTARROWS @@ -91,6 +94,7 @@ private: DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler) }; +#if wxUSE_TIMER // ---------------------------------------------------------------------------- // wxAutoScrollTimer: the timer used to generate a stream of scroll events when // a captured mouse is held outside the window @@ -175,6 +179,7 @@ void wxAutoScrollTimer::Notify() } } } +#endif // ---------------------------------------------------------------------------- // wxScrollHelperEvtHandler @@ -617,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 @@ -718,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 @@ -1072,11 +1090,13 @@ bool wxScrollHelper::SendAutoScrollEvents(wxScrollWinEvent& event) const void wxScrollHelper::StopAutoScrolling() { +#if wxUSE_TIMER if ( m_timerAutoScroll ) { delete m_timerAutoScroll; m_timerAutoScroll = (wxTimer *)NULL; } +#endif } void wxScrollHelper::HandleOnMouseEnter(wxMouseEvent& event) @@ -1138,6 +1158,7 @@ void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event) if ( !m_targetWindow->HasScrollbar(orient) ) return; +#if wxUSE_TIMER delete m_timerAutoScroll; m_timerAutoScroll = new wxAutoScrollTimer ( @@ -1148,6 +1169,7 @@ void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event) orient ); m_timerAutoScroll->Start(50); // FIXME: make configurable +#endif } }