summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-01-29 13:16:50 +0000
committerVaxry <vaxry@vaxry.net>2025-01-29 13:34:11 +0000
commit61319197155cbcb3b8d5f004f46c2249029ec1f3 (patch)
tree740a246931106a9cffa48838ce8ec7bb46bc882d /src
parentaaa5573c73636a76dd3ae4758bfd89ae4d5eeb8a (diff)
monitor: round refresh rates in sorting modes
fixes #9209
Diffstat (limited to 'src')
-rw-r--r--src/helpers/Monitor.cpp7
-rw-r--r--src/helpers/Monitor.hpp4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 19d68a56..9ea85bca 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -456,9 +456,9 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// sort prioritizing refresh rate 1st and resolution 2nd, then add best 3
addBest3Modes([](auto const& a, auto const& b) {
- if (a->refreshRate > b->refreshRate)
+ if (std::round(a->refreshRate) > std::round(b->refreshRate))
return true;
- else if (DELTALESSTHAN((float)a->refreshRate, (float)b->refreshRate, 1000) && a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y)
+ else if (DELTALESSTHAN((float)a->refreshRate, (float)b->refreshRate, 1.F) && a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y)
return true;
return false;
});
@@ -469,7 +469,8 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
addBest3Modes([](auto const& a, auto const& b) {
if (a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y)
return true;
- else if (DELTALESSTHAN(a->pixelSize.x, b->pixelSize.x, 1) && DELTALESSTHAN(a->pixelSize.y, b->pixelSize.y, 1) && a->refreshRate > b->refreshRate)
+ else if (DELTALESSTHAN(a->pixelSize.x, b->pixelSize.x, 1) && DELTALESSTHAN(a->pixelSize.y, b->pixelSize.y, 1) &&
+ std::round(a->refreshRate) > std::round(b->refreshRate))
return true;
return false;
});
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index 7c19b57c..1b207f7d 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -33,7 +33,7 @@ struct SMonitorRule {
Vector2D resolution = Vector2D(1280, 720);
Vector2D offset = Vector2D(0, 0);
float scale = 1;
- float refreshRate = 60;
+ float refreshRate = 60; // Hz
bool disabled = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
std::string mirrorOf = "";
@@ -92,7 +92,7 @@ class CMonitor {
CDamageRing damage;
SP<Aquamarine::IOutput> output;
- float refreshRate = 60;
+ float refreshRate = 60; // Hz
int forceFullFrames = 0;
bool scheduledRecalc = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;