summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorIkalco <73481042+ikalco@users.noreply.github.com>2024-12-30 12:45:42 -0600
committerGitHub <noreply@github.com>2024-12-30 18:45:42 +0000
commitaf301312d5b9d69a39fd0a7584d2891f34d40430 (patch)
tree9a6bdf9966f22ae65b7cce064f9ef6b03c979535 /src/helpers/Monitor.cpp
parent8c14c2a5f472cf3d361d3cbb90ee7d2d455aae08 (diff)
core: fix custom resolutions (#8897)
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 3fb90959..01bb79ac 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -479,6 +479,12 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
return false;
});
+ // if the best mode isnt close to requested, then try requested as custom mode first
+ auto bestMode = requestedModes.back();
+ if (!DELTALESSTHAN(bestMode->pixelSize.x, RULE->resolution.x, 1) || !DELTALESSTHAN(bestMode->pixelSize.y, RULE->resolution.y, 1) ||
+ !DELTALESSTHAN(bestMode->refreshRate / 1000.f, RULE->refreshRate, 1))
+ requestedModes.push_back(makeShared<Aquamarine::SOutputMode>(Aquamarine::SOutputMode{.pixelSize = RULE->resolution, .refreshRate = RULE->refreshRate * 1000.f}));
+
// then if requested is custom, try custom mode first
if (RULE->drmMode.type == DRM_MODE_TYPE_USERDEF) {
if (output->getBackend()->type() != Aquamarine::eBackendType::AQ_BACKEND_DRM)