Skip to content

Commit

Permalink
output-layout: select mode with closest matching refresh rate (#2229)
Browse files Browse the repository at this point in the history
This makes it possible to avoid the annoying cases where the monitor
provides 59994 as a refresh rate, and the user cannot say to use @60
instead.
  • Loading branch information
ammen99 authored Mar 21, 2024
1 parent 72fd13d commit 3d2ddca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ wlr_output_mode *find_matching_mode(wlr_output *output,
return mode;
}

if (!best || (best->refresh < mode->refresh))
const int bestSoFar = std::abs(best->refresh - reference.refresh);
const int current = std::abs(mode->refresh - reference.refresh);
if (!best || (bestSoFar > current))
{
best = mode;
}
Expand Down

0 comments on commit 3d2ddca

Please sign in to comment.