twin: prevent cursor appearing off-window when untiling while moving

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/375/head
Mavridis Philippe 9 months ago committed by Michele Calgaro
parent bc6893644c
commit 42f97b681b
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -2331,6 +2331,14 @@ bool Client::startMoveResize()
// Restore original geometry // Restore original geometry
activeTiled = false; activeTiled = false;
if (options->resetMaximizedWindowGeometry() && isMove()) { 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); setGeometry(activeTiledOrigGeom);
} }
} }
@ -2415,6 +2423,7 @@ void Client::finishMoveResize( bool cancel )
setGeometry(cancel ? initialMoveResizeGeom setGeometry(cancel ? initialMoveResizeGeom
: activeBorderMaximizeGeometry()); : activeBorderMaximizeGeometry());
} }
activeTiledOrigGeom.moveTopLeft(rect().topLeft());
} }
checkMaximizeGeometry(); checkMaximizeGeometry();
@ -2743,7 +2752,10 @@ void Client::setActiveBorderMaximizing( bool maximizing )
} }
void Client::cancelActiveBorderMaximizing() { void Client::cancelActiveBorderMaximizing() {
if (!activeMaximizing) return;
activeMaximizing = false; 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) { if (rules()->checkMoveResizeMode(options->tilingMode) == Options::Transparent) {
clearbound(); clearbound();
} }

Loading…
Cancel
Save