Don't update focused pointer window on pointer movement while button is pressed
If a button is pressed all mouse events should go to the current surface regardless of whether the pointer is on top of it or not.
This commit is contained in:
parent
8468da197c
commit
8b3be23032
2 changed files with 18 additions and 1 deletions
18
input.cpp
18
input.cpp
|
@ -465,7 +465,10 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
|
|||
return;
|
||||
}
|
||||
QWeakPointer<Toplevel> 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()) {
|
||||
|
|
1
input.h
1
input.h
|
@ -183,6 +183,7 @@ private:
|
|||
void updateFocusedPointerPosition();
|
||||
void updateFocusedTouchPosition();
|
||||
void updateTouchWindow(const QPointF &pos);
|
||||
bool areButtonsPressed() const;
|
||||
QPointF m_globalPointer;
|
||||
QHash<uint32_t, PointerButtonState> m_pointerButtons;
|
||||
#if HAVE_XKB
|
||||
|
|
Loading…
Reference in a new issue