From d6ea601005664bd86c46193d8e27de659d3dc479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Thu, 29 May 2014 22:40:05 +0200 Subject: [PATCH] keep oversized windows in fullscreen area huge windows are not contrained to their initial screen (the user might want to move them to the other instead), but we must not let them drop out of the fullscreen area either CCBUG: 335043 Forward port of d7c2434a9e144dd2e7f1519d78b333e7d4d3bfc7 from kde-workspace --- manage.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/manage.cpp b/manage.cpp index e021ff506a..fbdf195704 100644 --- a/manage.cpp +++ b/manage.cpp @@ -398,7 +398,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) // Window is too large for the screen, maximize in the // directions necessary const QSize ss = workspace()->clientArea(ScreenArea, area.center(), desktop()).size(); - const QSize fs = workspace()->clientArea(FullArea, geom.center(), desktop()).size(); + const QRect fsa = workspace()->clientArea(FullArea, geom.center(), desktop()); const QSize cs = clientSize(); int pseudo_max = Client::MaximizeRestore; if (width() >= area.width()) @@ -414,10 +414,15 @@ bool Client::manage(xcb_window_t w, bool isMapped) // i intended a second check on cs < area.size() ("the managed client ("minus border") is smaller // than the workspace") but gtk / gimp seems to store it's size including the decoration, // thus a former maximized window wil become non-maximized - if (width() < fs.width() && (cs.width() > ss.width()+1)) + bool keepInFsArea = false; + if (width() < fsa.width() && (cs.width() > ss.width()+1)) { pseudo_max &= ~Client::MaximizeHorizontal; - if (height() < fs.height() && (cs.height() > ss.height()+1)) + keepInFsArea = true; + } + if (height() < fsa.height() && (cs.height() > ss.height()+1)) { pseudo_max &= ~Client::MaximizeVertical; + keepInFsArea = true; + } if (pseudo_max != Client::MaximizeRestore) { maximize((MaximizeMode)pseudo_max); @@ -433,6 +438,8 @@ bool Client::manage(xcb_window_t w, bool isMapped) geom_restore.setWidth(width()); } } + if (keepInFsArea) + keepInArea(fsa, partial_keep_in_area); } }