sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 915ba01ff1388028a85156feb08e9296c356a696
parent 0d04864fd110a533af250e9cc716db08f2f501ea
Author: Ronan Pigott <rpigott@berkeley.edu>
Date:   Fri, 15 Jan 2021 13:44:22 -0700

config/output: correct refresh rate rounding error

Diffstat:
Msway/config/output.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sway/config/output.c b/sway/config/output.c @@ -237,7 +237,10 @@ struct output_config *store_output_config(struct output_config *oc) { static void set_mode(struct wlr_output *output, int width, int height, float refresh_rate, bool custom) { - int mhz = (int)(refresh_rate * 1000); + // Not all floating point integers can be represented exactly + // as (int)(1000 * mHz / 1000.f) + // round() the result to avoid any error + int mhz = (int)round(refresh_rate * 1000); if (wl_list_empty(&output->modes) || custom) { sway_log(SWAY_DEBUG, "Assigning custom mode to %s", output->name);