Move initialMoveResizeGeometry to AbstractClient

This commit is contained in:
Martin Gräßlin 2015-10-16 09:57:53 +02:00
parent 84c7575cbf
commit b4fc4d7235
4 changed files with 20 additions and 7 deletions

View file

@ -1059,4 +1059,9 @@ void AbstractClient::doMove(int, int)
{
}
void AbstractClient::updateInitialMoveResizeGeometry()
{
m_moveResize.initialGeometry = geometry();
}
}

View file

@ -635,6 +635,13 @@ protected:
void setInvertedMoveOffset(const QPoint &offset) {
m_moveResize.invertedOffset = offset;
}
QRect initialMoveResizeGeometry() const {
return m_moveResize.initialGeometry;
}
/**
* Sets the initial move resize geometry to the current geometry.
**/
void updateInitialMoveResizeGeometry();
private:
void handlePaletteChange();
@ -687,6 +694,7 @@ private:
bool unrestricted = false;
QPoint offset;
QPoint invertedOffset;
QRect initialGeometry;
} m_moveResize;
};

View file

@ -638,7 +638,6 @@ private:
Position mode;
QRect moveResizeGeom;
QRect initialMoveResizeGeom;
Xcb::GeometryHints m_geometryHints;
void sendSyntheticConfigureNotify();
enum MappingState {

View file

@ -2657,7 +2657,8 @@ bool Client::startMoveResize()
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
moveResizeStartScreen = screen();
initialMoveResizeGeom = moveResizeGeom = geometry();
updateInitialMoveResizeGeometry();
moveResizeGeom = geometry();
checkUnrestrictedMoveResize();
emit clientStartUserMovedResized(this);
if (ScreenEdges::self()->isDesktopSwitchingMovingClients())
@ -2671,13 +2672,13 @@ void Client::finishMoveResize(bool cancel)
leaveMoveResize();
if (cancel)
setGeometry(initialMoveResizeGeom);
setGeometry(initialMoveResizeGeometry());
else {
if (wasResize) {
const bool restoreH = maximizeMode() == MaximizeHorizontal &&
moveResizeGeom.width() != initialMoveResizeGeom.width();
moveResizeGeom.width() != initialMoveResizeGeometry().width();
const bool restoreV = maximizeMode() == MaximizeVertical &&
moveResizeGeom.height() != initialMoveResizeGeom.height();
moveResizeGeom.height() != initialMoveResizeGeometry().height();
if (restoreH || restoreV) {
changeMaximize(restoreV, restoreH, false);
}
@ -2757,7 +2758,7 @@ void Client::checkUnrestrictedMoveResize()
left_marge = qMin(100 + borderRight(), moveResizeGeom.width());
right_marge = qMin(100 + borderLeft(), moveResizeGeom.width());
// width/height change with opaque resizing, use the initial ones
titlebar_marge = initialMoveResizeGeom.height();
titlebar_marge = initialMoveResizeGeometry().height();
top_marge = borderBottom();
bottom_marge = borderTop();
if (isResize()) {
@ -2900,7 +2901,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
bool update = false;
if (isResize()) {
QRect orig = initialMoveResizeGeom;
QRect orig = initialMoveResizeGeometry();
Sizemode sizemode = SizemodeAny;
auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode]() {
switch(mode) {