xdgshellclient: fix moveresize with touch and CSD

When moveresize is done with touch we need to use the current touch
point and not the mouse position.

BUG: 438283
CCBUG: 431489
This commit is contained in:
Xaver Hugl 2021-07-01 01:34:54 +02:00
parent a4dcfbfb31
commit f54d7a2697

View file

@ -21,6 +21,7 @@
#if KWIN_BUILD_ACTIVITIES #if KWIN_BUILD_ACTIVITIES
#include "activities.h" #include "activities.h"
#endif #endif
#include "touch_input.h"
#include <KDecoration2/DecoratedClient> #include <KDecoration2/DecoratedClient>
#include <KDecoration2/Decoration> #include <KDecoration2/Decoration>
@ -961,7 +962,13 @@ void XdgToplevelClient::handleMoveRequested(SeatInterface *seat, quint32 serial)
return; return;
} }
if (isMovable()) { if (isMovable()) {
performMouseCommand(Options::MouseMove, Cursors::self()->mouse()->pos()); QPoint cursorPos;
if (seat->hasImplicitPointerGrab(serial)) {
cursorPos = Cursors::self()->mouse()->pos();
} else {
cursorPos = input()->touch()->position().toPoint();
}
performMouseCommand(Options::MouseMove, cursorPos);
} else { } else {
qCDebug(KWIN_CORE) << this << "is immovable, ignoring the move request"; qCDebug(KWIN_CORE) << this << "is immovable, ignoring the move request";
} }
@ -979,7 +986,13 @@ void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, Qt::Edges edg
finishInteractiveMoveResize(false); finishInteractiveMoveResize(false);
} }
setInteractiveMoveResizePointerButtonDown(true); setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveOffset(Cursors::self()->mouse()->pos() - pos()); // map from global QPoint cursorPos;
if (seat->hasImplicitPointerGrab(serial)) {
cursorPos = Cursors::self()->mouse()->pos();
} else {
cursorPos = input()->touch()->position().toPoint();
}
setInteractiveMoveOffset(cursorPos - pos()); // map from global
setInvertedInteractiveMoveOffset(rect().bottomRight() - interactiveMoveOffset()); setInvertedInteractiveMoveOffset(rect().bottomRight() - interactiveMoveOffset());
setUnrestrictedInteractiveMoveResize(false); setUnrestrictedInteractiveMoveResize(false);
auto toPosition = [edges] { auto toPosition = [edges] {