]> git.saurik.com Git - wxWidgets.git/commitdiff
added mouse wheel support (patch 1696082)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Apr 2007 22:28:42 +0000 (22:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Apr 2007 22:28:42 +0000 (22:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/x11/window.cpp

index 9256834e9e22271a11189ce7d897ccf36d579921..74b77b8c3ee099633ab9d2d101715201cc1018bb 100644 (file)
@@ -127,6 +127,10 @@ wxMSW:
 - Fixed infinite loop in wxThread::Wait() in console applications.
 - Return the restored window size from GetSize() when window is minimized.
 
+wxX11:
+
+- Added mouse wheel support (David Hart)
+
 
 2.8.4
 -----
index 2ebaa57dfc16b93d8f57ddb452b96b1668682737..a2ea6261c2beb33013ba5f7ee57a1e0fc2553312 100644 (file)
@@ -1463,6 +1463,22 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
                     eventType = wxEVT_RIGHT_DOWN;
                     button = 3;
                 }
+                else if ( xevent->xbutton.button == Button4 ||
+                            xevent->xbutton.button == Button5 )
+                {
+                    // this is the same value as used under wxMSW
+                    static const int WHEEL_DELTA = 120;
+
+                    eventType = wxEVT_MOUSEWHEEL;
+                    button = xevent->xbutton.button;
+
+                    wxevent.m_linesPerAction = 3;
+                    wxevent.m_wheelDelta = WHEEL_DELTA;
+
+                    // Button 4 means mousewheel up, 5 means down
+                    wxevent.m_wheelRotation = button == Button4 ? WHEEL_DELTA
+                                                                : -WHEEL_DELTA;
+                }
 
                 // check for a double click
                 // TODO: where can we get this value from?