Move initialMoveResizeGeometry to AbstractClient
This commit is contained in:
parent
84c7575cbf
commit
b4fc4d7235
4 changed files with 20 additions and 7 deletions
|
@ -1059,4 +1059,9 @@ void AbstractClient::doMove(int, int)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractClient::updateInitialMoveResizeGeometry()
|
||||||
|
{
|
||||||
|
m_moveResize.initialGeometry = geometry();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,6 +635,13 @@ protected:
|
||||||
void setInvertedMoveOffset(const QPoint &offset) {
|
void setInvertedMoveOffset(const QPoint &offset) {
|
||||||
m_moveResize.invertedOffset = 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:
|
private:
|
||||||
void handlePaletteChange();
|
void handlePaletteChange();
|
||||||
|
@ -687,6 +694,7 @@ private:
|
||||||
bool unrestricted = false;
|
bool unrestricted = false;
|
||||||
QPoint offset;
|
QPoint offset;
|
||||||
QPoint invertedOffset;
|
QPoint invertedOffset;
|
||||||
|
QRect initialGeometry;
|
||||||
} m_moveResize;
|
} m_moveResize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
1
client.h
1
client.h
|
@ -638,7 +638,6 @@ private:
|
||||||
|
|
||||||
Position mode;
|
Position mode;
|
||||||
QRect moveResizeGeom;
|
QRect moveResizeGeom;
|
||||||
QRect initialMoveResizeGeom;
|
|
||||||
Xcb::GeometryHints m_geometryHints;
|
Xcb::GeometryHints m_geometryHints;
|
||||||
void sendSyntheticConfigureNotify();
|
void sendSyntheticConfigureNotify();
|
||||||
enum MappingState {
|
enum MappingState {
|
||||||
|
|
13
geometry.cpp
13
geometry.cpp
|
@ -2657,7 +2657,8 @@ bool Client::startMoveResize()
|
||||||
|
|
||||||
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
|
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
|
||||||
moveResizeStartScreen = screen();
|
moveResizeStartScreen = screen();
|
||||||
initialMoveResizeGeom = moveResizeGeom = geometry();
|
updateInitialMoveResizeGeometry();
|
||||||
|
moveResizeGeom = geometry();
|
||||||
checkUnrestrictedMoveResize();
|
checkUnrestrictedMoveResize();
|
||||||
emit clientStartUserMovedResized(this);
|
emit clientStartUserMovedResized(this);
|
||||||
if (ScreenEdges::self()->isDesktopSwitchingMovingClients())
|
if (ScreenEdges::self()->isDesktopSwitchingMovingClients())
|
||||||
|
@ -2671,13 +2672,13 @@ void Client::finishMoveResize(bool cancel)
|
||||||
leaveMoveResize();
|
leaveMoveResize();
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
setGeometry(initialMoveResizeGeom);
|
setGeometry(initialMoveResizeGeometry());
|
||||||
else {
|
else {
|
||||||
if (wasResize) {
|
if (wasResize) {
|
||||||
const bool restoreH = maximizeMode() == MaximizeHorizontal &&
|
const bool restoreH = maximizeMode() == MaximizeHorizontal &&
|
||||||
moveResizeGeom.width() != initialMoveResizeGeom.width();
|
moveResizeGeom.width() != initialMoveResizeGeometry().width();
|
||||||
const bool restoreV = maximizeMode() == MaximizeVertical &&
|
const bool restoreV = maximizeMode() == MaximizeVertical &&
|
||||||
moveResizeGeom.height() != initialMoveResizeGeom.height();
|
moveResizeGeom.height() != initialMoveResizeGeometry().height();
|
||||||
if (restoreH || restoreV) {
|
if (restoreH || restoreV) {
|
||||||
changeMaximize(restoreV, restoreH, false);
|
changeMaximize(restoreV, restoreH, false);
|
||||||
}
|
}
|
||||||
|
@ -2757,7 +2758,7 @@ void Client::checkUnrestrictedMoveResize()
|
||||||
left_marge = qMin(100 + borderRight(), moveResizeGeom.width());
|
left_marge = qMin(100 + borderRight(), moveResizeGeom.width());
|
||||||
right_marge = qMin(100 + borderLeft(), moveResizeGeom.width());
|
right_marge = qMin(100 + borderLeft(), moveResizeGeom.width());
|
||||||
// width/height change with opaque resizing, use the initial ones
|
// width/height change with opaque resizing, use the initial ones
|
||||||
titlebar_marge = initialMoveResizeGeom.height();
|
titlebar_marge = initialMoveResizeGeometry().height();
|
||||||
top_marge = borderBottom();
|
top_marge = borderBottom();
|
||||||
bottom_marge = borderTop();
|
bottom_marge = borderTop();
|
||||||
if (isResize()) {
|
if (isResize()) {
|
||||||
|
@ -2900,7 +2901,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
|
|
||||||
bool update = false;
|
bool update = false;
|
||||||
if (isResize()) {
|
if (isResize()) {
|
||||||
QRect orig = initialMoveResizeGeom;
|
QRect orig = initialMoveResizeGeometry();
|
||||||
Sizemode sizemode = SizemodeAny;
|
Sizemode sizemode = SizemodeAny;
|
||||||
auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode]() {
|
auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode]() {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
|
|
Loading…
Reference in a new issue