diff options
author | Simon Rettberg | 2019-03-01 15:20:50 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-03-01 15:20:50 +0100 |
commit | 54c6b5d7dcb44bbb6912c74ec77213836307d021 (patch) | |
tree | 359acd0797c410f2123ab99abc576dcede12a7f5 | |
parent | Fix it by doing dunnowhat (diff) | |
download | beamergui-23.tar.gz beamergui-23.tar.xz beamergui-23.zip |
Make auto-center smarter (hopefully)v23
-rw-r--r-- | src/xx.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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; |