diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/minimal-cpp/compositor.cpp | 8 | ||||
-rw-r--r-- | examples/wayland/minimal-cpp/compositor.h | 2 | ||||
-rw-r--r-- | examples/wayland/minimal-cpp/window.cpp | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/examples/wayland/minimal-cpp/compositor.cpp b/examples/wayland/minimal-cpp/compositor.cpp index fa9ae2da9..a4b989975 100644 --- a/examples/wayland/minimal-cpp/compositor.cpp +++ b/examples/wayland/minimal-cpp/compositor.cpp @@ -163,9 +163,13 @@ void Compositor::handleMouseMove(const QPoint &position) defaultSeat()->sendMouseMoveEvent(view, mapToView(view, position)); } -void Compositor::handleMouseWheel(Qt::Orientation orientation, int delta) +void Compositor::handleMouseWheel(const QPoint &angleDelta) { - defaultSeat()->sendMouseWheelEvent(orientation, delta); + // TODO: fix this to send a single event, when diagonal scrolling is supported + if (angleDelta.x() != 0) + defaultSeat()->sendMouseWheelEvent(Qt::Horizontal, angleDelta.x()); + if (angleDelta.y() != 0) + defaultSeat()->sendMouseWheelEvent(Qt::Vertical, angleDelta.y()); } void Compositor::handleKeyPress(quint32 nativeScanCode) diff --git a/examples/wayland/minimal-cpp/compositor.h b/examples/wayland/minimal-cpp/compositor.h index 3c0c80e0e..e32442dd4 100644 --- a/examples/wayland/minimal-cpp/compositor.h +++ b/examples/wayland/minimal-cpp/compositor.h @@ -102,7 +102,7 @@ public: void handleMousePress(const QPoint &position, Qt::MouseButton button); void handleMouseRelease(const QPoint &position, Qt::MouseButton button, Qt::MouseButtons buttons); void handleMouseMove(const QPoint &position); - void handleMouseWheel(Qt::Orientation orientation, int delta); + void handleMouseWheel(const QPoint &angleDelta); void handleKeyPress(quint32 nativeScanCode); void handleKeyRelease(quint32 nativeScanCode); diff --git a/examples/wayland/minimal-cpp/window.cpp b/examples/wayland/minimal-cpp/window.cpp index f32fb515c..9f22cc68a 100644 --- a/examples/wayland/minimal-cpp/window.cpp +++ b/examples/wayland/minimal-cpp/window.cpp @@ -129,7 +129,7 @@ void Window::mouseMoveEvent(QMouseEvent *event) void Window::wheelEvent(QWheelEvent *event) { - m_compositor->handleMouseWheel(event->orientation(), event->delta()); + m_compositor->handleMouseWheel(event->angleDelta()); } void Window::keyPressEvent(QKeyEvent *e) |