summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xx.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/xx.cpp b/src/xx.cpp
index 8be1d96..0b91161 100644
--- a/src/xx.cpp
+++ b/src/xx.cpp
@@ -3,6 +3,7 @@
#include "cvt.h"
#include <QDebug>
#include <QSocketNotifier>
+#include <QThread>
/*
* This clusterfuck exists because there are name clashes between X11/Xrandr headers
@@ -453,6 +454,30 @@ ConfigBackup ScreenSetup::setCenteredClone()
break;
}
}
+ // See if we even need to do anything
+ for (int i = 0; i < 2; ++i) {
+ int withPref = 0;
+ QSet<RRMode> known;
+ for (auto oi : a->_outputMap) {
+ if (oi->output->npreferred == 0) {
+ if (oi->mode != nullptr) {
+ known.insert(oi->mode->id);
+ }
+ } else {
+ withPref++;
+ known.insert(oi->output->modes[0]);
+ }
+ }
+ if (withPref == 0 && i == 0) {
+ QThread::msleep(100);
+ updateScreenResources();
+ retval = createCrtcBackup();
+ continue;
+ }
+ if (known.count() < 2)
+ return retval;
+ break;
+ }
XGrabServer(a->_display);
a->disconnectAllCrtcs();
QSize screenSize;