summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2023-08-01 12:36:03 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-08-12 14:04:26 +0900
commit8a662b46fa97c2686b639ed9429e1850dcb91c9c (patch)
treebf953d6c01f4c62be4e8c970f4a9b25dd4d9f4f6
parenta64c48384870e07d06bc87ff14dfe711e2922f74 (diff)
downloadtdebase-8a662b46fa97c2686b639ed9429e1850dcb91c9c.tar.gz
tdebase-8a662b46fa97c2686b639ed9429e1850dcb91c9c.zip
twin: prevent cursor appearing off-window when untiling while moving
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit 42f97b681bd0a2bab49875cbcae5cacef4dfa7c2)
-rw-r--r--twin/geometry.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/twin/geometry.cpp b/twin/geometry.cpp
index 2dd752b02..5761f334b 100644
--- a/twin/geometry.cpp
+++ b/twin/geometry.cpp
@@ -2331,6 +2331,14 @@ bool Client::startMoveResize()
// Restore original geometry
activeTiled = false;
if (options->resetMaximizedWindowGeometry() && isMove()) {
+ /* Original geometry might be smaller than the tiled one, so the
+ * mouse pointer might appear off-window when untiling.
+ * Here we center the window horizontally under the mouse pointer.
+ * This should work with most window decorations.
+ */
+ activeTiledOrigGeom.moveLeft(TQCursor::pos().x() - (activeTiledOrigGeom.width() / 2));
+ moveOffset.setX(TQCursor::pos().x() - activeTiledOrigGeom.x());
+
setGeometry(activeTiledOrigGeom);
}
}
@@ -2415,6 +2423,7 @@ void Client::finishMoveResize( bool cancel )
setGeometry(cancel ? initialMoveResizeGeom
: activeBorderMaximizeGeometry());
}
+ activeTiledOrigGeom.moveTopLeft(rect().topLeft());
}
checkMaximizeGeometry();
@@ -2743,7 +2752,10 @@ void Client::setActiveBorderMaximizing( bool maximizing )
}
void Client::cancelActiveBorderMaximizing() {
+ if (!activeMaximizing) return;
activeMaximizing = false;
+
+ // If we are in transparent mode, we need to clear out the bound we had drawn
if (rules()->checkMoveResizeMode(options->tilingMode) == Options::Transparent) {
clearbound();
}