From 1df2d5979fb25cb83442b5df74c84d4cba6029eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 26 May 2015 22:34:31 +0200 Subject: [PATCH] keep quick maximized w/ size restritions in screen ... bounds BUG: 348121 REVIEW: 123910 --- geometry.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index acd0bf78fd..a204d64d46 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2317,10 +2317,12 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) r.setTopLeft(rules()->checkPosition(r.topLeft())); r.setSize(adjustedSize(r.size(), SizemodeMax)); if (r.size() != clientArea.size()) { // to avoid off-by-one errors... - if (isElectricBorderMaximizing() && r.width() < clientArea.width()) - r.moveLeft(Cursor::pos().x() - r.width()/2); - else + if (isElectricBorderMaximizing() && r.width() < clientArea.width()) { + r.moveLeft(qMax(clientArea.left(), Cursor::pos().x() - r.width()/2)); + r.moveRight(qMin(clientArea.right(), r.right())); + } else { r.moveCenter(clientArea.center()); + } r.moveTopLeft(rules()->checkPosition(r.topLeft())); } setGeometry(r, geom_mode);