summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2020-10-02 12:38:41 +0200
committerSimon Rettberg2020-10-02 12:38:41 +0200
commitdf4689bb9c47e4959e5894f847c53119b8b2c2a1 (patch)
treefabd44a4050cc327feb7e2cf386bddc9212813f3 /src/main.cpp
parentWider accepted refresh range; fix crash bug (diff)
downloadbeamergui-df4689bb9c47e4959e5894f847c53119b8b2c2a1.tar.gz
beamergui-df4689bb9c47e4959e5894f847c53119b8b2c2a1.tar.xz
beamergui-df4689bb9c47e4959e5894f847c53119b8b2c2a1.zip
--dump: Fall back to screen size if list is empty
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d2def2c..54bf745 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,6 +8,7 @@
#include <QTranslator>
#include <QCommandLineParser>
#include <QScreen>
+#include <QDesktopWidget>
namespace {
bool _testMode, _autoSetup, _showGui, _backgroundMode, _wakeup, _center, _dumpScreens;
@@ -199,6 +200,13 @@ static void dumpScreens()
qSort(list.begin(), list.end(), [](const QRect &one, const QRect &other) -> bool {
return one.y() < other.y() || (one.y() == other.y() && one.x() < other.x());
});
+ if (list.empty()) {
+ // Fallback to desktop size
+ QRect s = qApp->desktop()->screenGeometry();
+ if (s.width() > 0 && s.height() > 0) {
+ list.append(s);
+ }
+ }
int nextX = 0;
int lastY = 0;
qStdOut() << "# x y width height" << endl;