Move startMoveResize() to AbstractClient
The implementation calls a virtual doStartMoveResize() which allows Client to do it's X11 specific tasks (creating moveResizeWindow, grabbing input). The base implementation is no longer virtual.
This commit is contained in:
parent
9e323227a1
commit
c83f041005
4 changed files with 47 additions and 30 deletions
|
@ -1124,9 +1124,9 @@ void AbstractClient::updateHaveResizeEffect()
|
||||||
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
|
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractClient::startMoveResize()
|
bool AbstractClient::doStartMoveResize()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -698,7 +698,16 @@ protected:
|
||||||
void updateCursor();
|
void updateCursor();
|
||||||
void startDelayedMoveResize();
|
void startDelayedMoveResize();
|
||||||
void stopDelayedMoveResize();
|
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);
|
void finishMoveResize(bool cancel);
|
||||||
/**
|
/**
|
||||||
* Leaves the move resize mode.
|
* Leaves the move resize mode.
|
||||||
|
|
2
client.h
2
client.h
|
@ -468,6 +468,7 @@ protected:
|
||||||
void setGeometryRestore(const QRect &geo) override;
|
void setGeometryRestore(const QRect &geo) override;
|
||||||
void updateTabGroupStates(TabGroup::States states) override;
|
void updateTabGroupStates(TabGroup::States states) override;
|
||||||
void doMove(int x, int y) override;
|
void doMove(int x, int y) override;
|
||||||
|
bool doStartMoveResize() override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void delayedSetShortcut();
|
void delayedSetShortcut();
|
||||||
|
@ -543,7 +544,6 @@ private:
|
||||||
int checkShadeGeometry(int w, int h);
|
int checkShadeGeometry(int w, int h);
|
||||||
void getSyncCounter();
|
void getSyncCounter();
|
||||||
void sendSyncRequest();
|
void sendSyncRequest();
|
||||||
bool startMoveResize() override;
|
|
||||||
void leaveMoveResize() override;
|
void leaveMoveResize() override;
|
||||||
void handleMoveResize(int x, int y, int x_root, int y_root);
|
void handleMoveResize(int x, int y, int x_root, int y_root);
|
||||||
void handleMoveResize(const QPoint &local, const QPoint &global);
|
void handleMoveResize(const QPoint &local, const QPoint &global);
|
||||||
|
|
60
geometry.cpp
60
geometry.cpp
|
@ -2605,7 +2605,7 @@ void Client::positionGeometryTip()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::startMoveResize()
|
bool AbstractClient::startMoveResize()
|
||||||
{
|
{
|
||||||
assert(!isMoveResize());
|
assert(!isMoveResize());
|
||||||
assert(QWidget::keyboardGrabber() == NULL);
|
assert(QWidget::keyboardGrabber() == NULL);
|
||||||
|
@ -2615,6 +2615,39 @@ bool Client::startMoveResize()
|
||||||
return false; // popups have grab
|
return false; // popups have grab
|
||||||
if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens()))
|
if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens()))
|
||||||
return false;
|
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;
|
bool has_grab = false;
|
||||||
// This reportedly improves smoothness of the moveresize operation,
|
// This reportedly improves smoothness of the moveresize operation,
|
||||||
// something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug*
|
// something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug*
|
||||||
|
@ -2638,31 +2671,6 @@ bool Client::startMoveResize()
|
||||||
m_moveResizeGrabWindow.reset();
|
m_moveResizeGrabWindow.reset();
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue