ignore mouse wheel events which are coming too fast to be processed (#9057)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3832,6 +3832,10 @@ protected:
|
||||
|
||||
bool m_lastKeyDownConsumed;
|
||||
|
||||
// the timestamp that consists of the last wheel event
|
||||
// added to the time taken to process that event.
|
||||
long m_lastWheelTimestamp;
|
||||
|
||||
friend class ScintillaWX;
|
||||
friend class Platform;
|
||||
#endif // !SWIG
|
||||
|
@@ -197,6 +197,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
|
||||
m_swx = new ScintillaWX(this);
|
||||
m_stopWatch.Start();
|
||||
m_lastKeyDownConsumed = false;
|
||||
m_lastWheelTimestamp = 0;
|
||||
m_vScrollBar = NULL;
|
||||
m_hScrollBar = NULL;
|
||||
#if wxUSE_UNICODE
|
||||
@@ -3782,12 +3783,21 @@ void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
||||
void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
|
||||
{
|
||||
// prevent having an event queue with wheel events that cannot be processed
|
||||
// reasonably fast (see ticket #9057)
|
||||
if ( m_lastWheelTimestamp <= evt.GetTimestamp() )
|
||||
{
|
||||
m_lastWheelTimestamp = m_stopWatch.Time();
|
||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||
evt.GetWheelDelta(),
|
||||
evt.GetLinesPerAction(),
|
||||
evt.ControlDown(),
|
||||
evt.IsPageScroll());
|
||||
m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp;
|
||||
m_lastWheelTimestamp += evt.GetTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -197,6 +197,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
|
||||
m_swx = new ScintillaWX(this);
|
||||
m_stopWatch.Start();
|
||||
m_lastKeyDownConsumed = false;
|
||||
m_lastWheelTimestamp = 0;
|
||||
m_vScrollBar = NULL;
|
||||
m_hScrollBar = NULL;
|
||||
#if wxUSE_UNICODE
|
||||
@@ -785,12 +786,21 @@ void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
||||
void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
|
||||
{
|
||||
// prevent having an event queue with wheel events that cannot be processed
|
||||
// reasonably fast (see ticket #9057)
|
||||
if ( m_lastWheelTimestamp <= evt.GetTimestamp() )
|
||||
{
|
||||
m_lastWheelTimestamp = m_stopWatch.Time();
|
||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||
evt.GetWheelDelta(),
|
||||
evt.GetLinesPerAction(),
|
||||
evt.ControlDown(),
|
||||
evt.IsPageScroll());
|
||||
m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp;
|
||||
m_lastWheelTimestamp += evt.GetTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -465,6 +465,10 @@ protected:
|
||||
|
||||
bool m_lastKeyDownConsumed;
|
||||
|
||||
// the timestamp that consists of the last wheel event
|
||||
// added to the time taken to process that event.
|
||||
long m_lastWheelTimestamp;
|
||||
|
||||
friend class ScintillaWX;
|
||||
friend class Platform;
|
||||
#endif // !SWIG
|
||||
|
Reference in New Issue
Block a user