diff options
author | Simon Rettberg | 2020-03-09 15:41:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-03-09 15:41:35 +0100 |
commit | 8be8f771637946812ff78decf6e19364cae6f6d2 (patch) | |
tree | 89ac962f287176fd6bbfd789a7f1eae41fc05884 /src/xx.cpp | |
parent | Add --resolutions and --mapping for manual setup (diff) | |
download | beamergui-8be8f771637946812ff78decf6e19364cae6f6d2.tar.gz beamergui-8be8f771637946812ff78decf6e19364cae6f6d2.tar.xz beamergui-8be8f771637946812ff78decf6e19364cae6f6d2.zip |
Use actually applied resolution when calculating screen offsets
Diffstat (limited to 'src/xx.cpp')
-rw-r--r-- | src/xx.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -402,13 +402,20 @@ ConfigBackup ScreenSetup::setDefaultMode(ScreenMode &mode) int offset = 0; for (int i = 0; i < outputSizes.size(); ++i) { const QSize &size = outputSizes.at(i); + unsigned int w = 0; if (i < projectors.size()) { - a->setOutputResolution(cmd, projectors.at(i), offset, 0, size); + auto *mode = a->setOutputResolution(cmd, projectors.at(i), offset, 0, size); + if (mode != nullptr && mode->width > w) { + w = mode->width; + } } if (i < screens.size()) { - a->setOutputResolution(cmd, screens.at(i), offset, 0, size); + auto *mode = a->setOutputResolution(cmd, screens.at(i), offset, 0, size); + if (mode != nullptr && mode->width > w) { + w = mode->width; + } } - offset += size.width(); + offset += w; } retval._ok = runXrandr(cmd); updateScreenResources(); // Re-Read @@ -555,14 +562,18 @@ ConfigBackup ScreenSetup::setCustom(const QList<QPair<QSize, QList<QString>>> &l if (e.second.isEmpty()) continue; const QSize &res = e.first; + unsigned int w = 0; for (auto outputName : e.second) { for (auto oi : a->_outputMap) { if (oi->outputName != outputName) continue; - a->setOutputResolution(cmd, oi, x, 0, res); + auto *mode = a->setOutputResolution(cmd, oi, x, 0, res); + if (mode != nullptr && mode->width > w) { + w = mode->width; + } } } - x += res.width(); + x += w; } retval._ok = runXrandr(cmd); return retval; |