window: restore special window states on moveresize cancel

BUG: 464507
This commit is contained in:
Xaver Hugl 2023-01-20 18:43:30 +01:00
parent d6b75907cc
commit 9f2ed2083c
2 changed files with 17 additions and 13 deletions

View file

@ -1607,6 +1607,12 @@ bool Window::startInteractiveMoveResize()
setInteractiveMoveResize(true);
workspace()->setMoveResizeWindow(this);
m_interactiveMoveResize.initialGeometry = moveResizeGeometry();
m_interactiveMoveResize.startOutput = moveResizeOutput();
m_interactiveMoveResize.initialMaximizeMode = requestedMaximizeMode();
m_interactiveMoveResize.initialQuickTileMode = quickTileMode();
m_interactiveMoveResize.initialGeometryRestore = geometryRestore();
if (requestedMaximizeMode() != MaximizeRestore) {
switch (interactiveMoveResizeGravity()) {
case Gravity::Left:
@ -1648,7 +1654,6 @@ bool Window::startInteractiveMoveResize()
setQuickTileMode(QuickTileFlag::None);
}
updateInitialMoveResizeGeometry();
updateElectricGeometryRestore();
checkUnrestrictedInteractiveMoveResize();
Q_EMIT clientStartUserMovedResized(this);
@ -1668,8 +1673,14 @@ void Window::finishInteractiveMoveResize(bool cancel)
if (cancel) {
moveResize(initialInteractiveMoveResizeGeometry());
}
if (moveResizeOutput() != interactiveMoveResizeStartOutput()) {
if (m_interactiveMoveResize.initialMaximizeMode != MaximizeMode::MaximizeRestore) {
setMaximize(m_interactiveMoveResize.initialMaximizeMode & MaximizeMode::MaximizeVertical, m_interactiveMoveResize.initialMaximizeMode & MaximizeMode::MaximizeHorizontal);
setGeometryRestore(m_interactiveMoveResize.initialGeometryRestore);
} else if (m_interactiveMoveResize.initialQuickTileMode) {
setQuickTileMode(m_interactiveMoveResize.initialQuickTileMode, true);
setGeometryRestore(m_interactiveMoveResize.initialGeometryRestore);
}
} else if (moveResizeOutput() != interactiveMoveResizeStartOutput()) {
workspace()->sendWindowToOutput(this, moveResizeOutput()); // checks rule validity
if (isRequestedFullScreen() || requestedMaximizeMode() != MaximizeRestore) {
checkWorkspacePosition();
@ -2750,12 +2761,6 @@ int Window::borderTop() const
return isDecorated() ? decoration()->borderTop() : 0;
}
void Window::updateInitialMoveResizeGeometry()
{
m_interactiveMoveResize.initialGeometry = frameGeometry();
m_interactiveMoveResize.startOutput = output();
}
void Window::updateCursor()
{
Gravity gravity = interactiveMoveResizeGravity();

View file

@ -1789,10 +1789,6 @@ protected:
{
return m_interactiveMoveResize.initialGeometry;
}
/**
* Sets the initial move resize geometry to the current geometry.
*/
void updateInitialMoveResizeGeometry();
void setMoveResizeGeometry(const QRectF &geo);
Gravity interactiveMoveResizeGravity() const
{
@ -2007,12 +2003,15 @@ private:
QPointF offset;
QPointF invertedOffset;
QRectF initialGeometry;
QRectF initialGeometryRestore;
Gravity gravity = Gravity::None;
bool buttonDown = false;
CursorShape cursor = Qt::ArrowCursor;
Output *startOutput = nullptr;
QTimer *delayedTimer = nullptr;
uint32_t counter = 0;
MaximizeMode initialMaximizeMode;
QuickTileMode initialQuickTileMode;
} m_interactiveMoveResize;
struct