Make axis events compatible with Weston
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Sat, 19 May 2012 09:26:23 +0000 (12:26 +0300)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Sun, 20 May 2012 14:13:19 +0000 (16:13 +0200)
From now on mouse wheel events will work both with qt-compositor and
Weston.

Change-Id: I54876cd45f3530ea9b4b7962ca52c0974e1cb2d5
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/compositor/wayland_wrapper/wlinputdevice.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.cpp

index 10be24b..a38057c 100644 (file)
@@ -263,7 +263,7 @@ void InputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
     uint32_t time = m_compositor->currentTimeMsecs();
     uint32_t axis = orientation == Qt::Horizontal ? WL_POINTER_AXIS_HORIZONTAL_SCROLL
                                                   : WL_POINTER_AXIS_VERTICAL_SCROLL;
-    wl_pointer_send_axis(resource, time, axis, delta);
+    wl_pointer_send_axis(resource, time, axis, delta / 120);
 }
 
 void InputDevice::sendKeyPressEvent(uint code)
index cbb922b..f835eb2 100644 (file)
@@ -338,10 +338,12 @@ void QWaylandInputDevice::pointer_axis(void *data,
     QWaylandWindow *window = inputDevice->mPointerFocus;
     Qt::Orientation orientation = axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ? Qt::Horizontal
                                                                             : Qt::Vertical;
-    QWindowSystemInterface::handleWheelEvent(window->window(), time,
+    QWindowSystemInterface::handleWheelEvent(window->window(),
+                                             time,
                                              inputDevice->mSurfacePos,
                                              inputDevice->mGlobalPos,
-                                             value, orientation);
+                                             value * 120,
+                                             orientation);
 }
 
 #ifndef QT_NO_WAYLAND_XKB