diff --git a/abstract_client.cpp b/abstract_client.cpp index df367a9f80..4d3b5b98da 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -458,4 +458,9 @@ QSize AbstractClient::minSize() const return rules()->checkMinSize(QSize(0, 0)); } +void AbstractClient::updateMoveResize(const QPointF ¤tGlobalCursor) +{ + Q_UNUSED(currentGlobalCursor) +} + } diff --git a/abstract_client.h b/abstract_client.h index 7034d4d4b3..73e06079ef 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -274,6 +274,7 @@ public: virtual void shrinkHorizontal(); virtual void growVertical(); virtual void shrinkVertical(); + virtual void updateMoveResize(const QPointF ¤tGlobalCursor); /** * These values represent positions inside an area diff --git a/client.h b/client.h index 4e213b0105..212ea6eeaf 100644 --- a/client.h +++ b/client.h @@ -510,6 +510,8 @@ public: **/ void showOnScreenEdge(); + void updateMoveResize(const QPointF ¤tGlobalCursor) override; + public Q_SLOTS: void closeWindow() override; void updateCaption(); @@ -649,6 +651,7 @@ private: void leaveMoveResize(); void checkUnrestrictedMoveResize(); void handleMoveResize(int x, int y, int x_root, int y_root); + void handleMoveResize(const QPoint &local, const QPoint &global); void startDelayedMoveResize(); void stopDelayedMoveResize(); void positionGeometryTip(); diff --git a/events.cpp b/events.cpp index 8719cc1a94..cdbcf65d60 100644 --- a/events.cpp +++ b/events.cpp @@ -1390,21 +1390,7 @@ bool Client::motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x_ro y = this->y(); } - const QRect oldGeo = geometry(); - handleMoveResize(x, y, x_root, y_root); - if (!isFullScreen() && isMove()) { - if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) { - GeometryUpdatesBlocker blocker(this); - setQuickTileMode(QuickTileNone); - moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) * double(geom_restore.width()), - double(moveOffset.y()) / double(oldGeo.height()) * double(geom_restore.height())); - if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore) - moveResizeGeom = geom_restore; - handleMoveResize(x, y, x_root, y_root); // fix position - } else if (quick_tile_mode == QuickTileNone && isResizable()) { - checkQuickTilingMaximizationZones(x_root, y_root); - } - } + handleMoveResize(QPoint(x, y), QPoint(x_root, y_root)); return true; } diff --git a/geometry.cpp b/geometry.cpp index 3bfb3cac03..f12113cd2d 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2710,6 +2710,30 @@ void Client::stopDelayedMoveResize() delayedMoveResizeTimer = NULL; } +void Client::updateMoveResize(const QPointF ¤tGlobalCursor) +{ + handleMoveResize(pos(), currentGlobalCursor.toPoint()); +} + +void Client::handleMoveResize(const QPoint &local, const QPoint &global) +{ + const QRect oldGeo = geometry(); + handleMoveResize(local.x(), local.y(), global.x(), global.y()); + if (!isFullScreen() && isMove()) { + if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) { + GeometryUpdatesBlocker blocker(this); + setQuickTileMode(QuickTileNone); + moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) * double(geom_restore.width()), + double(moveOffset.y()) / double(oldGeo.height()) * double(geom_restore.height())); + if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore) + moveResizeGeom = geom_restore; + handleMoveResize(local.x(), local.y(), global.x(), global.y()); // fix position + } else if (quick_tile_mode == QuickTileNone && isResizable()) { + checkQuickTilingMaximizationZones(global.x(), global.y()); + } + } +} + void Client::handleMoveResize(int x, int y, int x_root, int y_root) { if (syncRequest.isPending && isResize()) diff --git a/input.cpp b/input.cpp index bd620153d2..05cdc0fe3b 100644 --- a/input.cpp +++ b/input.cpp @@ -517,15 +517,19 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time) // an effect grabbed the pointer, we do not forward the event to surfaces return; } - QWeakPointer old = m_pointerWindow; - if (!areButtonsPressed()) { - // update pointer window only if no button is pressed - updatePointerWindow(); - } else if (m_pointerDecoration) { - const QPointF p = m_globalPointer - m_pointerDecoration->client()->pos(); - QHoverEvent event(QEvent::HoverMove, p, p); - QCoreApplication::instance()->sendEvent(m_pointerDecoration->decoration(), &event); - m_pointerDecoration->client()->processDecorationMove(); + if (AbstractClient *c = workspace()->getMovingClient()) { + c->updateMoveResize(m_globalPointer); + } else { + QWeakPointer old = m_pointerWindow; + if (!areButtonsPressed()) { + // update pointer window only if no button is pressed + updatePointerWindow(); + } else if (m_pointerDecoration) { + const QPointF p = m_globalPointer - m_pointerDecoration->client()->pos(); + QHoverEvent event(QEvent::HoverMove, p, p); + QCoreApplication::instance()->sendEvent(m_pointerDecoration->decoration(), &event); + m_pointerDecoration->client()->processDecorationMove(); + } } #if HAVE_WAYLAND if (auto seat = findSeat()) {