diff --git a/abstract_client.cpp b/abstract_client.cpp index 33efd0427d..3d24984f83 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1124,9 +1124,9 @@ void AbstractClient::updateHaveResizeEffect() s_haveResizeEffect = effects && static_cast(effects)->provides(Effect::Resize); } -bool AbstractClient::startMoveResize() +bool AbstractClient::doStartMoveResize() { - return false; + return true; } } diff --git a/abstract_client.h b/abstract_client.h index b408c818f2..890ecba2ec 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -698,7 +698,16 @@ protected: void updateCursor(); void startDelayedMoveResize(); void stopDelayedMoveResize(); - virtual bool startMoveResize(); + bool startMoveResize(); + /** + * Called from @link startMoveResize. + * + * Implementing classes should return @c false if starting move resize should + * get aborted. In that case @link startMoveResize will also return @c false. + * + * Base implementation returns @c true. + **/ + virtual bool doStartMoveResize(); void finishMoveResize(bool cancel); /** * Leaves the move resize mode. diff --git a/client.h b/client.h index eb869720e5..c0e318d44f 100644 --- a/client.h +++ b/client.h @@ -468,6 +468,7 @@ protected: void setGeometryRestore(const QRect &geo) override; void updateTabGroupStates(TabGroup::States states) override; void doMove(int x, int y) override; + bool doStartMoveResize() override; private Q_SLOTS: void delayedSetShortcut(); @@ -543,7 +544,6 @@ private: int checkShadeGeometry(int w, int h); void getSyncCounter(); void sendSyncRequest(); - bool startMoveResize() override; void leaveMoveResize() override; void handleMoveResize(int x, int y, int x_root, int y_root); void handleMoveResize(const QPoint &local, const QPoint &global); diff --git a/geometry.cpp b/geometry.cpp index 8571f47bcc..9f77694d46 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2605,7 +2605,7 @@ void Client::positionGeometryTip() } } -bool Client::startMoveResize() +bool AbstractClient::startMoveResize() { assert(!isMoveResize()); assert(QWidget::keyboardGrabber() == NULL); @@ -2615,6 +2615,39 @@ bool Client::startMoveResize() return false; // popups have grab if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) return false; + if (!doStartMoveResize()) { + return false; + } + + setMoveResize(true); + workspace()->setClientIsMoving(this); + + const Position mode = moveResizePointerMode(); + if (mode != PositionCenter) { // means "isResize()" but moveResizeMode = true is set below + if (maximizeMode() == MaximizeFull) { // partial is cond. reset in finishMoveResize + setGeometryRestore(geometry()); // "restore" to current geometry + setMaximize(false, false); + } + } + + if (quickTileMode() != QuickTileNone && mode != PositionCenter) { // Cannot use isResize() yet + // Exit quick tile mode when the user attempts to resize a tiled window + updateQuickTileMode(QuickTileNone); // Do so without restoring original geometry + setGeometryRestore(geometry()); + emit quickTileModeChanged(); + } + + updateHaveResizeEffect(); + updateInitialMoveResizeGeometry(); + checkUnrestrictedMoveResize(); + emit clientStartUserMovedResized(this); + if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) + ScreenEdges::self()->reserveDesktopSwitching(true, Qt::Vertical|Qt::Horizontal); + return true; +} + +bool Client::doStartMoveResize() +{ bool has_grab = false; // This reportedly improves smoothness of the moveresize operation, // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* @@ -2638,31 +2671,6 @@ bool Client::startMoveResize() m_moveResizeGrabWindow.reset(); return false; } - - setMoveResize(true); - workspace()->setClientIsMoving(this); - - const Position mode = moveResizePointerMode(); - if (mode != PositionCenter) { // means "isResize()" but moveResizeMode = true is set below - if (maximizeMode() == MaximizeFull) { // partial is cond. reset in finishMoveResize - geom_restore = geometry(); // "restore" to current geometry - setMaximize(false, false); - } - } - - if (quickTileMode() != QuickTileNone && mode != PositionCenter) { // Cannot use isResize() yet - // Exit quick tile mode when the user attempts to resize a tiled window - updateQuickTileMode(QuickTileNone); // Do so without restoring original geometry - geom_restore = geometry(); - emit quickTileModeChanged(); - } - - updateHaveResizeEffect(); - updateInitialMoveResizeGeometry(); - checkUnrestrictedMoveResize(); - emit clientStartUserMovedResized(this); - if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) - ScreenEdges::self()->reserveDesktopSwitching(true, Qt::Vertical|Qt::Horizontal); return true; }