summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2015-02-17 11:14:46 +0200
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2015-03-10 13:02:51 +0000
commitdc2b7a26a8266a58d6130b5c5b270d8de9cbfc40 (patch)
tree8aa11505fa31d866cec1a326b1ab415ff5e9c118
parentd5500d96005c2d617e14a43b41462b48e59fdd65 (diff)
Check the surface input mask for hover events
We also remove the hoverLeaveEvent() reimplementation, as it serves no real purpose. Change-Id: Ic218be864564032c38f91d3946ccfdf2ccfc0d25 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.cpp16
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.h1
2 files changed, 8 insertions, 9 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
index 06ea3ad48..c3951909f 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
@@ -174,6 +174,10 @@ void QWaylandSurfaceItem::mouseReleaseEvent(QMouseEvent *event)
void QWaylandSurfaceItem::hoverEnterEvent(QHoverEvent *event)
{
if (surface()) {
+ if (!surface()->inputRegionContains(event->pos())) {
+ event->ignore();
+ return;
+ }
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendMouseMoveEvent(this, event->pos());
}
@@ -182,14 +186,10 @@ void QWaylandSurfaceItem::hoverEnterEvent(QHoverEvent *event)
void QWaylandSurfaceItem::hoverMoveEvent(QHoverEvent *event)
{
if (surface()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(this, event->pos());
- }
-}
-
-void QWaylandSurfaceItem::hoverLeaveEvent(QHoverEvent *event)
-{
- if (surface()) {
+ if (!surface()->inputRegionContains(event->pos())) {
+ event->ignore();
+ return;
+ }
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendMouseMoveEvent(this, event->pos());
}
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h
index 7a4054227..7af8c8821 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.h
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h
@@ -94,7 +94,6 @@ protected:
void mouseReleaseEvent(QMouseEvent *event);
void hoverEnterEvent(QHoverEvent *event);
void hoverMoveEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);