summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-08-07 11:21:50 +0200
committerSimon Rettberg2020-08-07 11:21:50 +0200
commite7420aa7e9859241f7498803e68608889a3ff2c8 (patch)
treec183b650927f3bacb4dae0f5b9b1b3d266084868
parentRetry with lower resolution if auto-setup fails (diff)
downloadbeamergui-e7420aa7e9859241f7498803e68608889a3ff2c8.tar.gz
beamergui-e7420aa7e9859241f7498803e68608889a3ff2c8.tar.xz
beamergui-e7420aa7e9859241f7498803e68608889a3ff2c8.zip
Fix center mode (-c)
-rw-r--r--src/xx.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/xx.cpp b/src/xx.cpp
index 570f79d..1e529ae 100644
--- a/src/xx.cpp
+++ b/src/xx.cpp
@@ -540,20 +540,25 @@ ConfigBackup ScreenSetup::setCenteredClone()
break;
}
QStringList cmd;
- QSize screenSize; // Currently unused
+ QSize screenSize;
for (auto oi : a->_outputMap) {
auto mode = a->getPreferredMode(oi, fallback);
- if (mode != nullptr) {
- if (int(mode->width) > screenSize.width()) {
- screenSize.setWidth(int(mode->width));
- }
- if (int(mode->height) > screenSize.height()) {
- screenSize.setHeight(int(mode->height));
- }
- const int x = (screenSize.width() - int(mode->width)) / 2;
- const int y = (screenSize.height() - int(mode->height)) / 2;
- a->setOutputResolution(cmd, oi, x, y, QSize(int(mode->width), int(mode->height)));
+ if (mode == nullptr)
+ continue;
+ if (int(mode->width) > screenSize.width()) {
+ screenSize.setWidth(int(mode->width));
}
+ if (int(mode->height) > screenSize.height()) {
+ screenSize.setHeight(int(mode->height));
+ }
+ }
+ for (auto oi : a->_outputMap) {
+ auto mode = a->getPreferredMode(oi, fallback);
+ if (mode == nullptr)
+ continue;
+ const int x = (screenSize.width() - int(mode->width)) / 2;
+ const int y = (screenSize.height() - int(mode->height)) / 2;
+ a->setOutputResolution(cmd, oi, x, y, QSize(int(mode->width), int(mode->height)));
}
retval._ok = runXrandr(cmd);
return retval;