Port Window::updateInteractiveMoveResize() away from input()->keyboardModifiers()

Since 12c12b3af1, input()->keyboardModifiers()
doesn't work on X. Modifiers need to be pulled from input events.
This commit is contained in:
Vlad Zahorodnii 2024-07-15 16:50:40 +03:00
parent 56f99cb6f4
commit 7575de4b02
12 changed files with 53 additions and 42 deletions

View file

@ -141,19 +141,19 @@ void WobblyWindowsShadeTest::testShadeMove()
// send some key events, not going through input redirection
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
// wait for frame rendered
QTest::qWait(100);
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
// wait for frame rendered
QTest::qWait(100);
window->keyPressEvent(Qt::Key_Down | Qt::ALT);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
// wait for frame rendered
QTest::qWait(100);

View file

@ -128,19 +128,19 @@ void MoveResizeWindowTest::testMove()
// send some key events, not going through input redirection
const QPointF cursorPos = Cursors::self()->mouse()->pos();
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QEXPECT_FAIL("", "First event is ignored", Continue);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
interactiveMoveResizeSteppedSpy.clear();
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(16, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
window->keyPressEvent(Qt::Key_Down | Qt::ALT);
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 2);
QCOMPARE(window->frameGeometry(), QRect(16, 32, 100, 50));
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(16, 32));
@ -220,7 +220,7 @@ void MoveResizeWindowTest::testResize()
// Trigger a change.
const QPointF cursorPos = Cursors::self()->mouse()->pos();
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
// The client should receive a configure event with the new size.
@ -242,7 +242,7 @@ void MoveResizeWindowTest::testResize()
// Go down.
window->keyPressEvent(Qt::Key_Down);
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 8));
// The client should receive another configure event.

View file

@ -341,7 +341,7 @@ void TilesTest::resizeTileFromWindow()
// Trigger a change.
QPoint cursorPos = window->frameGeometry().bottomRight().toPoint();
input()->pointer()->warp(cursorPos + QPoint(8, 0));
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
// The client should receive a configure event with the new size.
@ -383,7 +383,7 @@ void TilesTest::resizeTileFromWindow()
// Trigger a change.
cursorPos = window->frameGeometry().bottomRight().toPoint();
input()->pointer()->warp(cursorPos + QPoint(0, 8));
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(0, 8));
// The client should receive a configure event with the new size.

View file

@ -1857,21 +1857,21 @@ void X11WindowTest::testMinimumSize()
const qreal scale = kwinApp()->xwaylandScale();
window->keyPressEvent(Qt::Key_Left);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(-8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 0);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().width(), 100 / scale);
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 0);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().width(), 100 / scale);
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(frameGeometryChangedSpy.wait());
@ -1879,21 +1879,21 @@ void X11WindowTest::testMinimumSize()
QCOMPARE(window->clientSize().width(), 100 / scale + 8);
window->keyPressEvent(Qt::Key_Up);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, -8));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().height(), 200 / scale);
window->keyPressEvent(Qt::Key_Down);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().height(), 200 / scale);
window->keyPressEvent(Qt::Key_Down);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 8));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 2);
QVERIFY(frameGeometryChangedSpy.wait());
@ -1962,42 +1962,42 @@ void X11WindowTest::testMaximumSize()
const qreal scale = kwinApp()->xwaylandScale();
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 0);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().width(), 100 / scale);
window->keyPressEvent(Qt::Key_Left);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos);
QVERIFY(!interactiveMoveResizeSteppedSpy.wait(10));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 0);
QCOMPARE(window->clientSize().width(), 100 / scale);
window->keyPressEvent(Qt::Key_Left);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(-8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(window->clientSize().width(), 100 / scale - 8);
window->keyPressEvent(Qt::Key_Down);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(-8, 8));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().height(), 200 / scale);
window->keyPressEvent(Qt::Key_Up);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(-8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QVERIFY(!frameGeometryChangedSpy.wait(10));
QCOMPARE(window->clientSize().height(), 200 / scale);
window->keyPressEvent(Qt::Key_Up);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(-8, -8));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 2);
QVERIFY(frameGeometryChangedSpy.wait());

View file

@ -344,7 +344,7 @@ void TestXdgShellWindowRules::testPositionApply()
const QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
m_window->keyPressEvent(Qt::Key_Right);
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QCOMPARE(m_window->pos(), QPoint(50, 42));
@ -393,7 +393,7 @@ void TestXdgShellWindowRules::testPositionRemember()
const QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
m_window->keyPressEvent(Qt::Key_Right);
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QCOMPARE(m_window->pos(), QPoint(50, 42));
@ -485,7 +485,7 @@ void TestXdgShellWindowRules::testPositionApplyNow()
const QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
m_window->keyPressEvent(Qt::Key_Right);
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
QCOMPARE(m_window->pos(), QPoint(50, 42));
@ -613,7 +613,7 @@ void TestXdgShellWindowRules::testSizeApply()
const QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
m_window->keyPressEvent(Qt::Key_Right);
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QVERIFY(m_surfaceConfigureRequestedSpy->wait());
QCOMPARE(m_surfaceConfigureRequestedSpy->count(), 4);
@ -710,7 +710,7 @@ void TestXdgShellWindowRules::testSizeRemember()
const QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
m_window->keyPressEvent(Qt::Key_Right);
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
m_window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QVERIFY(m_surfaceConfigureRequestedSpy->wait());
QCOMPARE(m_surfaceConfigureRequestedSpy->count(), 4);

View file

@ -1216,7 +1216,7 @@ void TestXdgShellWindow::testXdgWindowGeometryInteractiveResize()
// Go right.
QPointF cursorPos = KWin::Cursors::self()->mouse()->pos();
window->keyPressEvent(Qt::Key_Right);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
@ -1234,7 +1234,7 @@ void TestXdgShellWindow::testXdgWindowGeometryInteractiveResize()
// Go down.
cursorPos = KWin::Cursors::self()->mouse()->pos();
window->keyPressEvent(Qt::Key_Down);
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
window->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos(), Qt::KeyboardModifiers());
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(0, 8));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 4);

View file

@ -1180,14 +1180,14 @@ bool X11Window::motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x
const QPointF delta(QPointF(x, y) - offset);
if (delta.manhattanLength() >= QApplication::startDragDistance()) {
if (startInteractiveMoveResize()) {
updateInteractiveMoveResize(QPointF(x_root, y_root));
updateInteractiveMoveResize(QPointF(x_root, y_root), x11ToQtKeyboardModifiers(state));
} else {
setInteractiveMoveResizePointerButtonDown(false);
}
updateCursor();
}
} else {
updateInteractiveMoveResize(QPointF(x_root, y_root));
updateInteractiveMoveResize(QPointF(x_root, y_root), x11ToQtKeyboardModifiers(state));
if (isInteractiveMove()) {
workspace()->screenEdges()->check(QPoint(x_root, y_root), QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC));
@ -1329,6 +1329,7 @@ void X11Window::NETMoveResize(qreal x_root, qreal y_root, NET::Direction directi
}
setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveResizeAnchor(QPointF(x_root, y_root));
setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers());
setInteractiveMoveOffset(QPointF(qreal(x_root - x()) / width(), qreal(y_root - y()) / height())); // map from global
setUnrestrictedInteractiveMoveResize(false);
setInteractiveMoveResizeGravity(convert[direction]);

View file

@ -603,7 +603,7 @@ public:
}
switch (event->type()) {
case QEvent::MouseMove:
window->updateInteractiveMoveResize(event->screenPos());
window->updateInteractiveMoveResize(event->screenPos(), input()->keyboardModifiers());
break;
case QEvent::MouseButtonRelease:
if (event->buttons() == Qt::NoButton) {
@ -631,7 +631,7 @@ public:
}
if (window->isInteractiveMove() || window->isInteractiveResize()) {
// only update if mode didn't end
window->updateInteractiveMoveResize(input()->globalPointer());
window->updateInteractiveMoveResize(input()->globalPointer(), input()->keyboardModifiers());
}
return true;
}
@ -656,7 +656,7 @@ public:
m_set = true;
}
if (m_id == id) {
window->updateInteractiveMoveResize(pos);
window->updateInteractiveMoveResize(pos, input()->keyboardModifiers());
}
return true;
}
@ -685,7 +685,7 @@ public:
}
switch (event->type()) {
case QEvent::TabletMove:
window->updateInteractiveMoveResize(event->globalPosF());
window->updateInteractiveMoveResize(event->globalPosF(), input()->keyboardModifiers());
break;
case QEvent::TabletRelease:
window->endInteractiveMoveResize();

View file

@ -39,7 +39,7 @@ bool MovingClientX11Filter::event(xcb_generic_event_t *event)
client->keyPressEvent(keyQt, keyEvent->time);
if (client->isInteractiveMove() || client->isInteractiveResize()) {
const QPointF global = QPointF(Xcb::fromXNative(keyEvent->root_x), Xcb::fromXNative(keyEvent->root_y));
client->updateInteractiveMoveResize(global);
client->updateInteractiveMoveResize(global, x11ToQtKeyboardModifiers(keyEvent->state));
}
return true;
}
@ -47,7 +47,7 @@ bool MovingClientX11Filter::event(xcb_generic_event_t *event)
if (client->isInteractiveMove() || client->isInteractiveResize()) {
auto *keyEvent = reinterpret_cast<xcb_key_release_event_t *>(event);
const QPointF global = QPointF(Xcb::fromXNative(keyEvent->root_x), Xcb::fromXNative(keyEvent->root_y));
client->updateInteractiveMoveResize(global);
client->updateInteractiveMoveResize(global, x11ToQtKeyboardModifiers(keyEvent->state));
}
return true;
}

View file

@ -1259,7 +1259,7 @@ void Window::finishInteractiveMoveResize(bool cancel)
if (isElectricBorderMaximizing()) {
setQuickTileMode(electricBorderMode());
setElectricBorderMaximizing(false);
} else if (wasMove && (input()->keyboardModifiers() & Qt::ShiftModifier)) {
} else if (wasMove && (m_interactiveMoveResize.modifiers & Qt::ShiftModifier)) {
setQuickTileMode(QuickTileFlag::Custom);
}
setElectricBorderMode(QuickTileMode(QuickTileFlag::None));
@ -1351,9 +1351,10 @@ void Window::stopDelayedInteractiveMoveResize()
m_interactiveMoveResize.delayedTimer = nullptr;
}
void Window::updateInteractiveMoveResize(const QPointF &global)
void Window::updateInteractiveMoveResize(const QPointF &global, Qt::KeyboardModifiers modifiers)
{
setInteractiveMoveResizeAnchor(global);
setInteractiveMoveResizeModifiers(modifiers);
// ShadeHover or ShadeActive, ShadeNormal was already avoided above
const Gravity gravity = interactiveMoveResizeGravity();
@ -1412,7 +1413,7 @@ void Window::updateInteractiveMoveResize(const QPointF &global)
}
if (!isRequestedFullScreen()) {
if (input()->keyboardModifiers() & Qt::ShiftModifier) {
if (modifiers & Qt::ShiftModifier) {
resetQuickTilingMaximizationZones();
const auto &r = quickTileGeometry(QuickTileFlag::Custom, global);
if (r.isEmpty()) {
@ -2117,6 +2118,7 @@ bool Window::performMouseCommand(Options::MouseCommand cmd, const QPointF &globa
setInteractiveMoveResizeGravity(Gravity::None);
setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveResizeAnchor(globalPos);
setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers());
setInteractiveMoveOffset(QPointF(qreal(globalPos.x() - x()) / width(), qreal(globalPos.y() - y()) / height())); // map from global
setUnrestrictedInteractiveMoveResize((cmd == Options::MouseActivateRaiseAndUnrestrictedMove
|| cmd == Options::MouseUnrestrictedMove));
@ -2136,6 +2138,7 @@ bool Window::performMouseCommand(Options::MouseCommand cmd, const QPointF &globa
}
setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveResizeAnchor(globalPos);
setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers());
const QPointF moveOffset = QPointF(globalPos.x() - x(), globalPos.y() - y()); // map from global
setInteractiveMoveOffset(QPointF(moveOffset.x() / width(), moveOffset.y() / height()));
int x = moveOffset.x(), y = moveOffset.y();
@ -2695,7 +2698,7 @@ void Window::processDecorationMove(const QPointF &localPos, const QPointF &globa
const QPointF delta(localPos - offset);
if (delta.manhattanLength() >= QApplication::startDragDistance()) {
if (startInteractiveMoveResize()) {
updateInteractiveMoveResize(globalPos);
updateInteractiveMoveResize(globalPos, input()->keyboardModifiers());
} else {
setInteractiveMoveResizePointerButtonDown(false);
}
@ -2775,6 +2778,7 @@ bool Window::processDecorationButtonPress(const QPointF &localPos, const QPointF
setInteractiveMoveResizeGravity(mouseGravity());
setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveResizeAnchor(globalPos);
setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers());
setInteractiveMoveOffset(QPointF(qreal(localPos.x()) / width(), qreal(localPos.y()) / height()));
setUnrestrictedInteractiveMoveResize(false);
startDelayedInteractiveMoveResize();

View file

@ -1129,7 +1129,7 @@ public:
}
uint32_t interactiveMoveResizeCount() const;
void updateInteractiveMoveResize(const QPointF &global);
void updateInteractiveMoveResize(const QPointF &global, Qt::KeyboardModifiers modifiers);
/**
* Ends move resize when all pointer buttons are up again.
*/
@ -1591,6 +1591,10 @@ protected:
{
m_interactiveMoveResize.anchor = anchor;
}
void setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers modifiers)
{
m_interactiveMoveResize.modifiers = modifiers;
}
/**
* @returns whether the move resize mode is unrestricted.
*/
@ -1816,6 +1820,7 @@ protected:
bool enabled = false;
bool unrestricted = false;
QPointF anchor;
Qt::KeyboardModifiers modifiers;
QPointF offset;
QRectF initialGeometry;
QRectF initialGeometryRestore;

View file

@ -1014,6 +1014,7 @@ void XdgToplevelWindow::handleResizeRequested(SeatInterface *seat, XdgToplevelIn
cursorPos = input()->tablet()->position();
}
setInteractiveMoveResizeAnchor(cursorPos);
setInteractiveMoveResizeModifiers(Qt::KeyboardModifiers());
setInteractiveMoveOffset(QPointF((cursorPos.x() - x()) / width(), (cursorPos.y() - y()) / height())); // map from global
setUnrestrictedInteractiveMoveResize(false);
Gravity gravity;