From b6b85bdccb56b9eb8d4e5ebce4dc3ff776fc9ce8 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Fri, 27 Jul 2001 10:07:46 +0000
Subject: [PATCH] Added fix to send scroll messages from mouse wheel instead of
 scrolling directly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11191 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/generic/scrlwing.cpp | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp
index e3149ab601..deee047a93 100644
--- a/src/generic/scrlwing.cpp
+++ b/src/generic/scrlwing.cpp
@@ -978,9 +978,24 @@ void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
     {
         lines *= event.GetLinesPerAction();
 
-        int vsx, vsy;
-        GetViewStart(&vsx, &vsy);
-        Scroll(-1, vsy - lines);
+        wxScrollWinEvent newEvent;
+
+        newEvent.SetPosition(m_xScrollPosition - lines);
+        newEvent.SetOrientation(wxVERTICAL);
+        newEvent.m_eventObject = m_win;
+        if (lines > 0)
+            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+        else
+            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+
+        int times = abs(lines);
+        for (; times > 0; times --)
+            m_win->GetEventHandler()->ProcessEvent(newEvent);
+
+        /* Old Way */
+        // int vsx, vsy;
+        // GetViewStart(&vsx, &vsy);
+        // Scroll(-1, vsy - lines);    
     }
 }
 
-- 
2.47.2