diff --git a/pointer_input.cpp b/pointer_input.cpp --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -742,15 +742,17 @@ // locked pointer should not move return; } + const QRect curScreen(screens()->geometry(screens()->number(m_pos.toPoint()))); // verify that at least one screen contains the pointer position QPointF p = pos; if (!screenContainsPos(p)) { // allow either x or y to pass - p = QPointF(m_pos.x(), pos.y()); + p = QPointF(qBound(qreal(curScreen.left()), pos.x(), qreal(curScreen.right())), pos.y()); if (!screenContainsPos(p)) { - p = QPointF(pos.x(), m_pos.y()); + p = QPointF(pos.x(), qBound(qreal(curScreen.top()), pos.y(), qreal(curScreen.bottom()))); if (!screenContainsPos(p)) { - return; + p = QPointF(qBound(qreal(curScreen.left()), pos.x(), qreal(curScreen.right())), + qBound(qreal(curScreen.top()), pos.y(), qreal(curScreen.bottom()))); } } }