summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-10-02 12:38:41 +0200
committerSimon Rettberg2020-10-02 12:38:41 +0200
commitdf4689bb9c47e4959e5894f847c53119b8b2c2a1 (patch)
treefabd44a4050cc327feb7e2cf386bddc9212813f3
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
-rw-r--r--src/main.cpp8
-rw-r--r--src/widget.cpp6
-rw-r--r--src/xprivate.cpp10
-rw-r--r--src/xx.cpp4
4 files changed, 27 insertions, 1 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;
diff --git a/src/widget.cpp b/src/widget.cpp
index 6b231fa..ec0c4b3 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -345,7 +345,11 @@ void Widget::initControls(bool jumpToTab)
break;
}
}
- fillCombo(_ui->cboCloneResolution, modes, screenList[0].currentResolution, preferredClone);
+ if (screenList.empty()) {
+ fillCombo(_ui->cboCloneResolution, modes, QSize(), preferredClone);
+ } else {
+ fillCombo(_ui->cboCloneResolution, modes, screenList[0].currentResolution, preferredClone);
+ }
// Dual
_ui->dualContainer->takeAt(0);
_ui->dualContainer->takeAt(1);
diff --git a/src/xprivate.cpp b/src/xprivate.cpp
index 15447b7..ba5b805 100644
--- a/src/xprivate.cpp
+++ b/src/xprivate.cpp
@@ -181,9 +181,19 @@ void XPrivate::updateScreenResources()
_allOutputs.append(outputName);
tempMap.insert(_screenResources->outputs[i], outputName);
if (info->connection == RR_Disconnected) {
+ bool ign = !_crtcMap.contains(info->crtc);
+ if (!ign) {
+ ign = !_modeMap.contains(_crtcMap[info->crtc]->mode);
+ }
+ if (!ign) {
+ auto mode = _modeMap[_crtcMap[info->crtc]->mode];
+ ign = (mode->width == 0 || mode->height == 0);
+ }
+ if (ign) {
qDebug() << "Ignoring disconnected output" << outputName;
XRRFreeOutputInfo(info);
continue;
+ }
}
bool disconnected = false;
if (info->crtc == None && info->connection == RR_Connected) {
diff --git a/src/xx.cpp b/src/xx.cpp
index 8aab4ac..3ee2a2d 100644
--- a/src/xx.cpp
+++ b/src/xx.cpp
@@ -241,6 +241,10 @@ QMap<QString, ScreenInfo> ScreenSetup::getScreenPositions() const
{
QMap<QString, ScreenInfo> ret;
for (auto oi : a->_outputMap) {
+ if (oi->mode == nullptr)
+ continue;
+ if (oi->mode->width == 0 || oi->mode->height == 0)
+ continue;
ret.insert(oi->outputName, initScreenInfo(oi));
}
return ret;