summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.cpp2
-rw-r--r--src/plugins/platforms/wayland/qwaylandinputdevice.cpp20
2 files changed, 17 insertions, 5 deletions
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp
index c951ecf05..6b8f36409 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp
@@ -361,7 +361,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, wl_fixed_from_double(delta / 120.0));
+ wl_pointer_send_axis(resource, time, axis, wl_fixed_from_int(-delta / 12));
}
void InputDevice::updateModifierState(uint code, int state)
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
index a3a31e3d7..aaef268e5 100644
--- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
@@ -358,14 +358,26 @@ void QWaylandInputDevice::pointer_axis(void *data,
Q_UNUSED(pointer);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
QWaylandWindow *window = inputDevice->mPointerFocus;
- Qt::Orientation orientation = axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ? Qt::Horizontal
- : Qt::Vertical;
+ QPoint pixelDelta;
+ QPoint angleDelta;
+
+ //normalize value and inverse axis
+ int valueDelta = wl_fixed_to_int(value) * -12;
+
+ if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
+ pixelDelta = QPoint();
+ angleDelta.setX(valueDelta);
+ } else {
+ pixelDelta = QPoint();
+ angleDelta.setY(valueDelta);
+ }
+
QWindowSystemInterface::handleWheelEvent(window->window(),
time,
inputDevice->mSurfacePos,
inputDevice->mGlobalPos,
- int(wl_fixed_to_double(value) * 120.0),
- orientation);
+ pixelDelta,
+ angleDelta);
}
#ifndef QT_NO_WAYLAND_XKB