From 006f0e3eef707e9ea95b5d61606e95ba3c59b4ad Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Thu, 9 Oct 2014 18:10:11 +0200
Subject: [PATCH] Make sure the window doesn't grow out of QScreen bounds.

---
 src/calamares/CalamaresWindow.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp
index 49874ed6d2..c944df2dab 100644
--- a/src/calamares/CalamaresWindow.cpp
+++ b/src/calamares/CalamaresWindow.cpp
@@ -24,7 +24,9 @@
 #include "utils/CalamaresStyle.h"
 #include "utils/Logger.h"
 
+#include <QApplication>
 #include <QBoxLayout>
+#include <QDesktopWidget>
 #include <QLabel>
 #include <QTreeView>
 
@@ -34,9 +36,11 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
     // Hide close button
     setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint );
 
-    setMinimumSize( 1010, 600 );
-    int w = qMax( CalamaresUtils::defaultFontHeight() * 60, 1010 );
-    int h = qMax( CalamaresUtils::defaultFontHeight() * 36, 600 );
+    setMinimumSize( 1010, 560 );
+    QSize availableSize = qApp->desktop()->screenGeometry( this ).size();
+    int w = qBound( 1010, CalamaresUtils::defaultFontHeight() * 60, availableSize.width() );
+    int h = qBound( 560,  CalamaresUtils::defaultFontHeight() * 36, availableSize.height() );
+
     cDebug() << "Proposed window size:" << w << h;
     resize( w, h );
 
-- 
GitLab