summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <jeremy.katz@nokia.com>2010-01-06 17:25:34 (GMT)
committerJeremy Katz <jeremy.katz@nokia.com>2010-01-06 17:25:34 (GMT)
commite0ec5613e73d16ad91d5c267393b08f9193b4f3c (patch)
treea4941937baa880c4fa0e69cbaa946409ce9c055b
parent769ec23cc32c43ce9d519b39ac8dad2a04b78403 (diff)
downloadQt-e0ec5613e73d16ad91d5c267393b08f9193b4f3c.zip
Qt-e0ec5613e73d16ad91d5c267393b08f9193b4f3c.tar.gz
Qt-e0ec5613e73d16ad91d5c267393b08f9193b4f3c.tar.bz2
LinuxInputMouse wheel support
-rw-r--r--src/plugins/generic/linuxinput/qlinuxinput.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp
index 48084d0..308af6b 100644
--- a/src/plugins/generic/linuxinput/qlinuxinput.cpp
+++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp
@@ -134,6 +134,16 @@ void QLinuxInputMouseHandler::readMouseData()
m_x += data->value;
} else if (data->code == REL_Y) {
m_y += data->value;
+ } else if (data->code == ABS_WHEEL) { // vertical scroll
+ // data->value: 1 == up, -1 == down
+ int delta = 120 * data->value;
+ QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Vertical);
+ QApplicationPrivate::handleWheelEvent(0, we);
+ } else if (data->code == ABS_THROTTLE) { // horizontal scroll
+ // data->value: 1 == right, -1 == left
+ int delta = 120 * -data->value;
+ QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Horizontal);
+ QApplicationPrivate::handleWheelEvent(0, we);
} else {
unknown = true;
}