summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2015-05-09 10:29:15 +0300
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2015-06-09 08:23:33 +0000
commit9189a24ea7e6f1c56b58a7d8cf048ed9968d3161 (patch)
tree67c82762c4859f0943ae8ecb0fe6e7d4e85d5bc9
parentb350b3112c549fe75a54880bf5e58bb274eb874d (diff)
downloadqtwayland-9189a24ea7e6f1c56b58a7d8cf048ed9968d3161.tar.gz
Fix wheel events when the decorations are enabled
We must offset the wheel events' position, as we do with the other types of mouse events. Change-Id: If85e93ffe95304c7dee4c2a3ff195a73243a8182 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
-rw-r--r--src/client/qwaylandinputdevice.cpp15
-rw-r--r--src/client/qwaylandinputdevice_p.h13
-rw-r--r--src/client/qwaylandwindow.cpp6
3 files changed, 29 insertions, 5 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 76ae2586..009ef670 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -494,6 +494,15 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
}
}
+class WheelEvent : public QWaylandPointerEvent
+{
+public:
+ WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
+ : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad)
+ {
+ }
+};
+
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
{
QWaylandWindow *window = mFocus;
@@ -517,10 +526,8 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
angleDelta.setY(valueDelta);
}
- QWindowSystemInterface::handleWheelEvent(window->window(),
- time, mSurfacePos,
- mGlobalPos, pixelDelta,
- angleDelta);
+ WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta);
+ window->handleMouse(mParent, e);
}
#ifndef QT_NO_WAYLAND_XKB
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 23172ad3..6f3b25c0 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -259,7 +259,8 @@ class QWaylandPointerEvent
public:
enum Type {
Enter,
- Motion
+ Motion,
+ Wheel
};
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m)
: type(t)
@@ -269,6 +270,14 @@ public:
, buttons(b)
, modifiers(m)
{}
+ inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
+ : type(t)
+ , timestamp(ts)
+ , local(l)
+ , global(g)
+ , pixelDelta(pd)
+ , angleDelta(ad)
+ {}
Type type;
ulong timestamp;
@@ -276,6 +285,8 @@ public:
QPointF global;
Qt::MouseButtons buttons;
Qt::KeyboardModifiers modifiers;
+ QPoint pixelDelta;
+ QPoint angleDelta;
};
}
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index a775080a..922b1ee0 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -625,6 +625,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
case QWaylandPointerEvent::Motion:
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
break;
+ case QWaylandPointerEvent::Wheel:
+ QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta);
+ break;
}
}
@@ -684,6 +687,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
case QWaylandPointerEvent::Motion:
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
break;
+ case QWaylandPointerEvent::Wheel:
+ QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta);
+ break;
}
mMouseEventsInContentArea = true;