diff --git a/docs/changes.txt b/docs/changes.txt index 9256834e9e..74b77b8c3e 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 ----- diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 2ebaa57dfc..a2ea6261c2 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -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?