diff options
author | Simon Rettberg | 2020-12-14 12:04:22 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-12-14 12:04:22 +0100 |
commit | 29e7a6f24371bada9a97366c407e9b63b5533663 (patch) | |
tree | 244370e60511b7164a17e343aa6bc1c28a5adbea | |
parent | Always disable all outputs and use --fb if VIRTUAL output is missing (diff) | |
download | slxgreeter-29e7a6f24371bada9a97366c407e9b63b5533663.tar.gz slxgreeter-29e7a6f24371bada9a97366c407e9b63b5533663.tar.xz slxgreeter-29e7a6f24371bada9a97366c407e9b63b5533663.zip |
Fix layouting if no outputs are active
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 77c4932..c513282 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -158,6 +158,7 @@ void setupScreens() { // Get a list of non-overlapping screens, as this might lead to a broken // greeter with main windows covering other login forms + qDebug() << "Reposistioning greeter"; QMap<int, QRect> screens; QList<QRect> allNew; if (Global::testMode()) { @@ -165,6 +166,9 @@ void setupScreens() } else { for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) { QRect r = QApplication::desktop()->screenGeometry(i); + if (r.width() < 200 || r.height() < 200) + continue; // Sanity check + qDebug() << "Have screen" << r; allNew.append(r); QMutableMapIterator<int, QRect>it(screens); while (it.hasNext()) { @@ -184,6 +188,15 @@ void setupScreens() skip_rect: ; // Do nothing } } + if (screens.isEmpty()) { + // Huh? + QRect r = QApplication::desktop()->geometry(); + r.setTopLeft(QPoint(0, 0)); + r = r.united(QRect(0, 0, 640, 480)); + qDebug() << "No screens found, adding fake screen" << r; + screens.insert(0, r); + allNew.insert(0, r); + } // Spurious event? int primaryNew = QApplication::desktop()->primaryScreen(); |