summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorNikolaos Karaolidis <nick@karaolidis.com>2025-05-26 18:25:58 +0100
committerGitHub <noreply@github.com>2025-05-26 19:25:58 +0200
commitc2805aad92978577a4d89b14f1c4f51e50247547 (patch)
tree3e5e6eadb191f18aa7d48a1dfa254a10496f72f2 /src/helpers/Monitor.cpp
parent4c4c9bb324b9e17bddb72c4614b451775521ee24 (diff)
config: add maxwidth monitor resolution mode (#10528)
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 4dc0942d..72a221f5 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -515,7 +515,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
} else if (RULE->resolution == Vector2D(-1, -2)) {
requestedStr = "highres";
- // sort prioritizing resultion 1st and refresh rate 2nd, then add best 3
+ // sort prioritizing resolution 1st and refresh rate 2nd, then add best 3
addBest3Modes([](auto const& a, auto const& b) {
if (a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y)
return true;
@@ -524,6 +524,17 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
return true;
return false;
});
+ } else if (RULE->resolution == Vector2D(-1, -3)) {
+ requestedStr = "maxwidth";
+
+ // sort prioritizing widest resolution 1st and refresh rate 2nd, then add best 3
+ addBest3Modes([](auto const& a, auto const& b) {
+ if (a->pixelSize.x > b->pixelSize.x)
+ return true;
+ if (a->pixelSize.x == b->pixelSize.x && std::round(a->refreshRate) > std::round(b->refreshRate))
+ return true;
+ return false;
+ });
} else if (RULE->resolution != Vector2D()) {
// user requested mode
requestedStr = std::format("{:X0}@{:.2f}Hz", RULE->resolution, RULE->refreshRate);