summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-01 15:20:50 +0100
committerSimon Rettberg2019-03-01 15:20:50 +0100
commit54c6b5d7dcb44bbb6912c74ec77213836307d021 (patch)
tree359acd0797c410f2123ab99abc576dcede12a7f5
parentFix it by doing dunnowhat (diff)
downloadbeamergui-54c6b5d7dcb44bbb6912c74ec77213836307d021.tar.gz
beamergui-54c6b5d7dcb44bbb6912c74ec77213836307d021.tar.xz
beamergui-54c6b5d7dcb44bbb6912c74ec77213836307d021.zip
Make auto-center smarter (hopefully)v23
-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;