diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 06ea3ad4802f0c07b3fa598f5b0ca1ca2887517d..c3951909f1168b9c2b45669f700f3bcba3f5a639 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 7a40542278aaa8b534ef9e35aa9dd3f178115587..7af8c88217ff00e3346b6ec1656186c9b43f6ea2 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);