diff --git a/autotests/integration/effects/wobbly_shade_test.cpp b/autotests/integration/effects/wobbly_shade_test.cpp index 93cb92f8b5..55d27d1f2d 100644 --- a/autotests/integration/effects/wobbly_shade_test.cpp +++ b/autotests/integration/effects/wobbly_shade_test.cpp @@ -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); diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 55694cbd5f..0b0d7f41a6 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -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. diff --git a/autotests/integration/tiles_test.cpp b/autotests/integration/tiles_test.cpp index bbe2bc5db2..790811cd7f 100644 --- a/autotests/integration/tiles_test.cpp +++ b/autotests/integration/tiles_test.cpp @@ -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. diff --git a/autotests/integration/x11_window_test.cpp b/autotests/integration/x11_window_test.cpp index f153b8c05f..77313a7f6f 100644 --- a/autotests/integration/x11_window_test.cpp +++ b/autotests/integration/x11_window_test.cpp @@ -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()); diff --git a/autotests/integration/xdgshellwindow_rules_test.cpp b/autotests/integration/xdgshellwindow_rules_test.cpp index 2d32baf040..1893e20e80 100644 --- a/autotests/integration/xdgshellwindow_rules_test.cpp +++ b/autotests/integration/xdgshellwindow_rules_test.cpp @@ -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); diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp index 922ff4599d..bba9643521 100644 --- a/autotests/integration/xdgshellwindow_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -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); diff --git a/src/events.cpp b/src/events.cpp index a32851a246..88b5aed531 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -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]); diff --git a/src/input.cpp b/src/input.cpp index a7f9469430..52c5e4abd1 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -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(); diff --git a/src/moving_client_x11_filter.cpp b/src/moving_client_x11_filter.cpp index 3f5aea2c0c..42e11255e3 100644 --- a/src/moving_client_x11_filter.cpp +++ b/src/moving_client_x11_filter.cpp @@ -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(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; } diff --git a/src/window.cpp b/src/window.cpp index 5a8eb19a98..83370c6235 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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(); diff --git a/src/window.h b/src/window.h index fb883fb6b8..1720c3d5a7 100644 --- a/src/window.h +++ b/src/window.h @@ -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; diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp index 972fe05d1a..ddc476d66b 100644 --- a/src/xdgshellwindow.cpp +++ b/src/xdgshellwindow.cpp @@ -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;