From c639e79a98115b5ca13b7a9b27c237d8f155f342 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 17 Sep 2020 15:38:22 +0200 Subject: Wider accepted refresh range; fix crash bug --- src/xprivate.cpp | 2 +- src/xx.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xprivate.cpp b/src/xprivate.cpp index 53059e4..15447b7 100644 --- a/src/xprivate.cpp +++ b/src/xprivate.cpp @@ -672,7 +672,7 @@ bool XPrivate::addResolutionToOutput(OutputInfo *oi, const QSize &res) for (auto *mode : _modeMap) { if (int(mode->width) != res.width() || int(mode->height) != res.height()) continue; - if (toVertRefresh(mode) < 59 || toVertRefresh(mode) > 70) + if (toVertRefresh(mode) < 55 || toVertRefresh(mode) > 70) continue; // Play it safe if (bestMode == nullptr || abs(toVertRefresh(bestMode) - 60) > abs(toVertRefresh(mode) - 60)) { bestMode = mode; // As close to 60 as possible diff --git a/src/xx.cpp b/src/xx.cpp index d4a4608..8aab4ac 100644 --- a/src/xx.cpp +++ b/src/xx.cpp @@ -258,7 +258,7 @@ void ScreenSetup::initModes() QSet wanted; wanted << RES(1280, 720) << RES(1280, 800) << RES(1920, 1080); for (XRRModeInfo *mode : a->_modeMap) { - if (toVertRefresh(mode) < 58 || toVertRefresh(mode) > 61) + if (toVertRefresh(mode) < 55 || toVertRefresh(mode) > 65) continue; // Play it safe and consider only those for copying that are 60Hz if (!wanted.remove(RES(mode->width, mode->height))) continue; // Is not a wanted resolution @@ -612,6 +612,7 @@ ConfigBackup ScreenSetup::setCustom(const QList>> &l if (a->addResolutionToOutput(oi, res)) { reload = true; } + break; } } } @@ -633,6 +634,7 @@ ConfigBackup ScreenSetup::setCustom(const QList>> &l if (mode != nullptr && mode->width > w) { w = mode->width; } + break; } } x += w; -- cgit v1.2.3-55-g7522