diff --git a/input.cpp b/input.cpp index 57ba3c1035..ab627cd008 100644 --- a/input.cpp +++ b/input.cpp @@ -465,7 +465,10 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time) return; } QWeakPointer old = m_pointerWindow; - updatePointerWindow(); + if (!areButtonsPressed()) { + // update pointer window only if no button is pressed + updatePointerWindow(); + } #if HAVE_WAYLAND if (auto seat = findSeat()) { seat->setTimestamp(time); @@ -500,6 +503,9 @@ void InputRedirection::processPointerButton(uint32_t button, InputRedirection::P state == PointerButtonPressed ? seat->pointerButtonPressed(button) : seat->pointerButtonReleased(button); } #endif + if (state == PointerButtonReleased && !areButtonsPressed()) { + updatePointerWindow(); + } } void InputRedirection::processPointerAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time) @@ -789,6 +795,16 @@ Qt::MouseButtons InputRedirection::qtButtonStates() const return buttons; } +bool InputRedirection::areButtonsPressed() const +{ + for (auto it = m_pointerButtons.constBegin(); it != m_pointerButtons.constEnd(); ++it) { + if (it.value() == KWin::InputRedirection::PointerButtonPressed) { + return true; + } + } + return false; +} + Toplevel *InputRedirection::findToplevel(const QPoint &pos) { if (!Workspace::self()) { diff --git a/input.h b/input.h index a29d2d9d17..2a33e10945 100644 --- a/input.h +++ b/input.h @@ -183,6 +183,7 @@ private: void updateFocusedPointerPosition(); void updateFocusedTouchPosition(); void updateTouchWindow(const QPointF &pos); + bool areButtonsPressed() const; QPointF m_globalPointer; QHash m_pointerButtons; #if HAVE_XKB